Motivation
In today's cross-repo audit (2 of 20 repos), workflows with custom steps: blocks that include actions/checkout fail with:
error: strict mode: actions/checkout step(s) without 'persist-credentials: false' detected in the agent job: 'Checkout repository'. Without this setting the git token is stored in .git/config and leaked to the agent. Add 'persist-credentials: false' to the 'with:' block of each checkout step.
This fails even without --strict (it's a default check) and the fix is mechanical, so it is an excellent codemod candidate.
Affected repos in this audit
- githubnext/gh-aw-trial-oxpecker-test —
.github/workflows/daily-test-improver.md
- githubnext/gh-aw-trial-FSharpStats-copilot-cli —
.github/workflows/daily-test-improver.md
Both come from a daily-test-improver template that has not yet been patched.
Example
Before:
steps:
- name: Checkout repository
uses: actions/checkout@v5
After:
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
persist-credentials: false
Codemod sketch
- ID:
checkout-persist-credentials-false
- Scans the
steps: block in workflow frontmatter for any uses: actions/checkout@* step.
- If the step has no
with: block, adds with: { persist-credentials: false }.
- If the step has a
with: block but no persist-credentials key, adds persist-credentials: false to it.
- If
persist-credentials: true is set explicitly, emits a warning instead of mutating (user has explicitly opted in).
Considerations
- This codemod should also cover
pre-steps: and post-steps: if they are introduced in the same workflows.
- For nested checkouts inside
if-guarded steps, the codemod should still apply.
- The same logic could also patch the upstream
daily-test-improver template in github/gh-aw so newly minted trial repos don't regress.
Acceptance criteria
References:
Generated by Daily AW Cross-Repo Compile Check · ● 42.6M · ◷
Motivation
In today's cross-repo audit (2 of 20 repos), workflows with custom
steps:blocks that includeactions/checkoutfail with:This fails even without
--strict(it's a default check) and the fix is mechanical, so it is an excellent codemod candidate.Affected repos in this audit
.github/workflows/daily-test-improver.md.github/workflows/daily-test-improver.mdBoth come from a
daily-test-improvertemplate that has not yet been patched.Example
Before:
After:
Codemod sketch
checkout-persist-credentials-falsesteps:block in workflow frontmatter for anyuses: actions/checkout@*step.with:block, addswith: { persist-credentials: false }.with:block but nopersist-credentialskey, addspersist-credentials: falseto it.persist-credentials: trueis set explicitly, emits a warning instead of mutating (user has explicitly opted in).Considerations
pre-steps:andpost-steps:if they are introduced in the same workflows.if-guarded steps, the codemod should still apply.daily-test-improvertemplate in github/gh-aw so newly minted trial repos don't regress.Acceptance criteria
IntroducedInset to the current releasegh aw fix --writeon a fresh clone ofgithubnext/gh-aw-trial-oxpecker-testmakes the workflow compile cleanlyReferences:
#31473