docs: caller permissions are a requirement, not a minimum - #3
Merged
Conversation
The README said node-build.yml needs id-token: write only 'if run-codecov'. Wrong, and it cost three repos a red build: a called workflow's permissions must be equal to or MORE restrictive than the caller's, so the callee's unconditional id-token: write declaration means EVERY caller must grant it or the run dies with startup_failure before any job starts. Also documents the other half, found while trying to fix it the other way: if the reusable workflow omits its permissions block, the job does not inherit the caller's grant -- it drops to and even checkout fails with 'Repository not found'. So the block cannot simply be deleted, and a static block cannot vary with an input. Declaring the maximum and requiring callers to match is the only design that works. Co-Authored-By: Claude <noreply@anthropic.com>
RobFaustLZ
approved these changes
Jul 28, 2026
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.
Documentation fix, found by three real callers failing during the fan-out.
What broke
cf-analytics-pipeline,cf-queue-consumerandcf-api-gatewayall grantedcontents: read— which is what this README told them was enough whenrun-codecovis false. All three died withstartup_failurebefore a single job started. The Actions UI is unhelpful here: it says only "This run likely failed because of a workflow file issue."web-app-reactpassed, because it setsrun-codecov: trueand therefore grantedid-token: write.The rule is that a called workflow's permissions must be equal to or more restrictive than the caller's.
node-build.ymldeclaresid-token: writeunconditionally, so every caller must grant it — regardless ofrun-codecov.Why not just remove the declaration
That was my first fix, and it's wrong. I pushed it to a branch and pointed a real caller at it. The run started, then
actions/checkoutfailed:Omitting
permissions:in a called workflow does not inherit the caller's grant — the job drops toMetadata: read. So the block can't be deleted, and since a static block can't vary with an input, declaring the maximum and requiring callers to match is the only design that works.Declaring only
contents: readwas the other option, and it's worse: it would silently cap Codecov callers and stop their coverage uploads, withfail_ci_if_error: falsehiding the breakage.Changes
node-build.ymlrequirescontents: readandid-token: write, always.node-build.ymlexplains why the declaration is unconditional and why neither alternative works.No behaviour change —
node-build.yml's permissions are byte-identical to what's live at@v1. This does not need a release to unblock anything; the three affected callers are being fixed to grantid-token: writeagainst the current@v1.🤖 Generated with Claude Code