Ask for the token permission this workflow actually needs - #21
Merged
Conversation
fogproject's merge stub calls this workflow and grants `permissions: contents: read`, which is correct -- nothing on that path needs a writable GITHUB_TOKEN. The call was refused before a single job started: The workflow is requesting 'contents: write', but is only allowed 'contents: read'. A reusable workflow's `permissions:` is a REQUEST, not a ceiling, and GitHub rejects the call outright when the caller grants less rather than quietly capping it. Both of the stub's first two real merges ended in startup_failure -- no jobs, no logs, just "this run likely failed because of a workflow file issue", which is a hard failure to read backwards. The `contents: write` this asked for has been vestigial since #17. The checkout, the commit, the push and the badge write all run on GitHub App tokens now; `grep github.token` over this file returns nothing but the comment explaining why the badge stopped using it. So the request was for a token nothing here holds or uses, and its only real effect was to force every caller to grant write too. Lowering it to `read` fixes the caller without widening anyone's permissions, which is the right direction: the alternative is making fogproject grant write for a token it never exercises. The comment says not to raise it back, and why -- "be safe, ask for write" is the natural instinct and it is the exact change that breaks every caller at startup. If a step here ever does need the ambient token, it should get its own scoped App token, the way the badge step already does. Adds the same point to CLAUDE.md, next to the two trigger rules. Three distinct gotchas have now cost a round trip each on this one integration: whether the bot can raise its own trigger, which ref a trigger is read from, and this one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PqufBbuckux8kitJeW3uAK
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.
Merge this — the merge sync is currently failing on every merge
fogproject's merge stub now fires (that part works), but every run dies at startup:
Both real merges so far — FOGProject/fogproject#1171 and #1172 — ended in
startup_failure. Until this lands, every PR merged intoworking-1.6ordev-branchshows a red X and no sync happens.Cause
A reusable workflow's
permissions:is a request, not a ceiling. When the caller grants less, GitHub rejects the call outright rather than quietly capping it — no jobs, no logs, just "this run likely failed because of a workflow file issue". That is very hard to read backwards, which is why it took a page fetch of the run to see the actual message.fogproject's stub grants
permissions: contents: read, which is correct — nothing on that path needs a writableGITHUB_TOKEN.Fix: lower the request, don't widen the callers
The
contents: writehere has been vestigial since #17. The checkout, the commit, the push and the badge write all run on GitHub App tokens now —grep github.tokenover the file returns nothing but the comment explaining why the badge stopped using it.So the request was for a token nothing here holds or uses, and its only real effect was to force every caller to grant write as well. Lowering it to
readfixes the caller without widening anyone's permissions. The alternative — making fogproject grantcontents: writefor a token it never exercises — is the wrong direction.The comment says not to raise it back, and why: "be safe, ask for write" is the natural instinct, and it is the exact change that breaks every caller at startup. If a step here ever does need the ambient token, it should get its own scoped App token, the way the badge step already does.
CLAUDE.md
Adds this alongside the two trigger rules. Three distinct gotchas have now cost a round trip each on this one integration:
pull_request_targetreads the default branch)Verified
actionlintclean. Nogithub.token/GITHUB_TOKENusage remains in the workflow, so nothing loses a capability it was using. The scheduled sweep andstable-releases.yml's in-repo call are unaffected — both already grant at leastread.🤖 Generated with Claude Code
https://claude.ai/code/session_01PqufBbuckux8kitJeW3uAK