`fatal: ambiguous argument 'origin/main..HEAD': unknown revision` in the secrets-scan step
BeginnerTroubleshootingSAST, SCA and secrets scanning in CI
Answer
Likely causes → actions/checkout defaults to fetch-depth: 1, so the base branch ref does not exist in the runner.
Diagnose →
git branch -a
git log --oneline | wc -l
Fix →
- uses: actions/checkout@v4
with:
fetch-depth: 0
Or fetch just the base: git fetch origin main --depth=50.
Prevent → Any tool that diffs against a base (gitleaks, Semgrep diff-aware, SonarQube new-code) needs history; set fetch-depth: 0 in the shared workflow template.
More on SAST, SCA and secrets scanning in CI
gitleaks fails the PR on `tests/fixtures/fake_rsa.pem` and `testdata/aws_creds.json`, which only contain dummy valuesBeginnergitleaks passes locally but the CI job reports 40 old leaks nobody touched in this PRIntermediateSemgrep flags `subprocess.run(cmd, shell=True)` in a script where `cmd` is a hard-coded constantBeginnerSemgrep in CI reports findings in `node_modules/`, `vendor/` and minified `dist/*.js`BeginnerSemgrep job takes 35 minutes and gets killed with `exit code 137`IntermediateSonarQube Quality Gate fails on "Security Hotspots Reviewed is less than 100%" but there are no vulnerabilitiesBeginner