-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
CI secrets PR fast-path can fallback to full scan when base SHA missing in shallow checkout #38481
Copy link
Copy link
Closed
Description
Summary
In PR workflows, the secrets job computes changed files using github.event.pull_request.base.sha, but checkout uses fetch-depth: 1.
When the base commit is not present locally, the script falls back to pre-commit run --all-files detect-secrets, which can fail on known baseline noise unrelated to the PR diff.
Evidence
Recent PR run on #33298:
secretsstep logs:Falling back to full detect-secrets scan.- checkout config shows
fetch-depth: 1
Expected
PR secrets job should reliably scan changed files only (or fetch enough history to do so), and avoid full-repo fallback caused purely by shallow history.
Proposed fix
- Add
./.github/actions/ensure-base-commitbefore the secrets diff path on PR events - Use env-indirected GitHub context values in shell (
PR_BASE_SHA,PUSH_BEFORE_SHA) to keep zizmor/template-injection checks clean
Related
- Prior closed attempt: fix: unblock check and secrets CI failures #38353
- Follow-up fix PR: (to be linked)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.