Repository navigation
Conversation
The pr-scan and attach-release-assets jobs declare a job-level permissions block with id-token: write only. A job-level block replaces the full token permission set, so the workflow-level permissions do not apply to these jobs. As a result, the token has metadata: read only. actions/checkout cannot clone a private calling repository, and the release job cannot upload assets. Add the permissions that each job needs to its job-level block: - pr-scan: contents: read, pull-requests: write, id-token: write - attach-release-assets: contents: write, id-token: write Document in the README that a calling job must grant id-token: write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zepeng811
approved these changes
Nov 13, 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.
Summary
The
pr-scanandattach-release-assetsjobs declare a job-levelpermissionsblock that listsid-token: writeonly. GitHub uses a job-level block as the full permission set for that job. The workflow-levelpermissionsblock does not apply.The
GITHUB_TOKENof these jobs therefore holdsmetadata: readonly. This breaks two cases:pr-scan:actions/checkoutcannot clone a private calling repository. The step fails withfatal: repository '<owner>/<repo>' not found. The dependency review step also cannot post its pull request comment.attach-release-assets: the job cannot create a release or upload assets, because the token has nocontents: write.A public calling repository does not show the first failure, because
actions/checkoutcan clone a public repository without a token.v1.3.5 has no job-level block, so every job inherits the workflow-level permissions. The
v1tag points to v1.3.5 today, so current@v1callers do not see this defect. Callers see it after thev1tag moves to a later version.Change
This PR adds the permissions that each job needs to its job-level block:
pr-scan.yamlscanid-token: writecontents: read,pull-requests: write,id-token: writeattach-release-assets.yamlrelease_attach_assetsid-token: writecontents: write,id-token: writecontents: readletsactions/checkoutclone the calling repository.pull-requests: writelets the dependency review step post its summary comment. The step setscomment-summary-in-pr: always.contents: writelets the release job create a release and upload assets.id-token: writestays for thestep-security/harden-runnerstep.The README now states that a calling job must grant
id-token: write. GitHub does not let a reusable workflow request more permission than its caller grants. Without that grant, the run fails before any job starts.Relation to #37
#37 adds a workflow-level
permissions: contents: readblock topr-scan.yaml. That block does not reach thescanjob, because the job declares its own block. I tested the head commit of #37 from a private calling repository. The token still heldmetadata: readonly, andactions/checkoutfailed.Scope
actions-lint.yamlandconventional-commit-release.yamluse the same job-level pattern. This PR does not change them, because I cannot test them from a calling repository. They may need the same fix.Testing
I tested commit
5765788from a private calling repository. The calling jobs used thepermissionsblocks from the README example.scanMetadata: readContents: read,Metadata: read,PullRequests: writeCheckout Sourcerepository not foundThe calling workflow referenced the commit through the fork. GitHub Actions does not resolve a fork commit through the parent repository, so a
circlefin/...@5765788reference fails before the run starts.I did not run
attach-release-assetsfrom a calling repository. That job runs only on a push to the default branch. The change to that job uses the same rule as thescanjob.The checks of this repository pass on this PR.
🤖 Generated with Claude Code