ci: pass NO_COLOR=1 to semgrep help docker runs#2594
Closed
leifdreizler wants to merge 3 commits into
Closed
Conversation
The semgrep 1.161.0 image emits ANSI color escape codes even when stdout is piped, which causes the auto-generated help PR to be filled with literal escape sequences (e.g. `^[[4mUsage^[[24m`) instead of clean text. Setting NO_COLOR=1 on the docker invocation suppresses color output and restores clean diffs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for semgrep-docs-prod ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
semgrep's NO_COLOR support (semgrep/semgrep#4742) only covers findings output, not the Click/rich-click `--help` formatter. Try TERM=dumb, which rich-click's terminal detection may respect, before falling back to ANSI stripping. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NO_COLOR and TERM=dumb are both ignored by the Click/rich-click help formatter that semgrep uses (semgrep's NO_COLOR support only covers findings output via with_color()). Pipe the output through sed to strip CSI escape sequences instead — this works regardless of how semgrep chooses to format its help text. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
^[[4mUsage^[[24m,^[[36msemgrep^[[39m) instead of clean help text.update-help-commandworkflow to produce a non-empty diff every run for the same Semgrep version, which then opens PRs (and recently failed mid-flight in run 25121821139 and run 25121993218).NO_COLOR=1on the threedocker runinvocations suppresses color output and restores clean diffs, so reruns for an already-documented version will hit thegit diff --quietno-op branch.Test plan
Update semgrep help commandworkflow after merge and confirm it exits via "No changes made, exiting." for the current latest Semgrep version (1.161.0, already documented in Update help command output for Semgrep 1.161.0 #2583).🤖 Generated with Claude Code