Stop passing SUBMODULES_TOKEN to top-level checkout token input - #443
Conversation
antigravity-code-review.yml, gemini-code-review.yml, and gemini.yml all
passed `${{ secrets.SUBMODULES_TOKEN || github.token }}` as the token
for checking out the CALLER's own repo. SUBMODULES_TOKEN authenticates
a cross-owner submodule fetch, so a consumer that sets it correctly for
its own submodule gets a token with no read access to its own repo --
the main checkout then fails before the reviewer runs at all.
claude-code-review.yml already has this right: check out the caller
with the runner's default github.token, and authenticate the submodule
fetch separately through the shared checkout-submodules composite
action. All three workflows now follow that pattern.
Also adds a lint-checkout-tokens selftest job asserting no workflow in
this repo passes SUBMODULES_TOKEN to a top-level actions/checkout
token: input, per the issue's own suggested guard.
Fixes #442
|
Claude finished review — View run Review: #443 — "Stop passing SUBMODULES_TOKEN to top-level checkout token input"Summary of the change: Review process: Four independent passes were run — two CLAUDE.md-compliance audits and two Opus bug/security scans — each fetching the diff directly and verifying claims against the live repo tree (reading What was checked and cleared:
No high-signal bugs, security issues, or clear CLAUDE.md violations were found. No inline comments to post. VerdictReady for merge |
Fixes #442.
Problem
antigravity-code-review.ymlandgemini-code-review.ymlpassed${{ secrets.SUBMODULES_TOKEN || github.token }}as the token for checkingout the caller's own repository.
SUBMODULES_TOKENexists preciselybecause a submodule lives under a different owner than the consumer, so a
token scoped to read the submodule has no reason to be able to read the
caller's own repo — and in
ucdavis/bcsit could not: the main checkoutfailed with
fatal: could not read Username for 'https://github.com': terminal prompts disabledon every run (see the issue's observed logs).The
||fallback only fires whenSUBMODULES_TOKENis unset, so a repothat configures it correctly for its own submodule is exactly the repo that
breaks.
claude-code-review.ymlalready gets this right: the caller's own repo ischecked out with the runner's default
github.token, andSUBMODULES_TOKENis used only where a cross-owner submodule fetch actually needs it, via the
shared
checkout-submodulescomposite action.Grepping the whole repo for the same anti-pattern (
token: ${{ secrets. SUBMODULES_TOKEN, anchored so it doesn't also matchsubmodules-token:)turned up a third site the issue didn't enumerate:
gemini.yml(the@geminimention-handling agent workflow) carries the identical bug at itsown checkout step. Fixed it too, since it's the same defect, same one-line
mechanism, and the new lint below would otherwise fail on it.
Fix
All three workflows (
antigravity-code-review.yml,gemini-code-review.yml,gemini.yml) now:token:input on the top-levelactions/checkout)..github/actions/checkout-submodulescomposite action (gated oninputs.checkout-submodules), matchingclaude-code-review.yml.Guard
Per the issue's own "cheaper guard is a lint" suggestion,
_selftest.ymlgains a
lint-checkout-tokensjob that greps every workflow file and failsif any of them ever passes
SUBMODULES_TOKENto a top-levelactions/checkouttoken:input again. Verified it currently flags exactly the three sitesabove (and only those) before the fix, and is clean after.
Not in scope
The issue's second/third comments raise two related but explicitly separate
concerns:
ai-code-review.ymldoesn't fall through toanother agent when a dispatched one fails partway through (only when it
can't be dispatched at all).
ai-code-review.yml's own header commentalready documents this as a known, deliberately deferred limitation
("tracked separately rather than papered over here"), so no change needed
here.
inspection") — already resolved by this same token fix, since it shares
the identical root cause and checkout step.
Verification
python3 -c "import yaml; yaml.safe_load(open(f))"on all four editedworkflow files — clean.
grep -rnE '^\s*token:\s*\$\{\{[^}]*SUBMODULES_TOKEN' .github/workflows/*.yml— three hits before the fix (the sites above), zero after.
NLB_BASE_REF=origin/main python3 check-new-line-breaks/check-new-line-breaks.py— clean against the committed diff.
LC_ALL=C.UTF-8 grep -P) over the committeddiff's added lines — clean.
the
submodules:/token:lines being replaced; nothing incidental.Per
CLAUDE.md's "Test changes against a template repo" and "A PR fixingclaude-code-review.yml (or claude.yml) itself can't self-verify before merge"
sections: this PR does not touch
claude-code-review.yml/claude.ymlthemselves, and doesn't need a template-repo run since it's a workflow-file
change with no new composite-action interface — the new
lint-checkout-tokensselftest job is the closest thing to end-to-end coverage this class of bug
gets. A live test against
ucdavis/bcs(where the bug was originallyobserved) is the strongest real-world confirmation, but that's outside this
repo's own CI.
Generated by Claude Code