fix(ci/release): grant contents:write to goreleaser job#309
Merged
Conversation
The default GITHUB_TOKEN permissions are read-only in many repo/org
configurations, which makes the goreleaser action fail at the "scm
releases" step with `403 Resource not accessible by integration`
when trying to PATCH the GitHub Release.
Deny everything at the workflow level (`permissions: {}`) and grant
`contents: write` only to the goreleaser job, following the
least-privilege principle. Mirrors vulsio/go-cpe-dictionary#275.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub Actions GoReleaser workflow to follow least-privilege GitHub token permissions while still allowing GoReleaser to publish/update GitHub Releases on tag pushes.
Changes:
- Set workflow-level token permissions to none (
permissions: {}). - Grant
contents: writeonly to thegoreleaserjob so the release step can modify GitHub Releases without 403 permission failures.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
GITHUB_TOKENpermissions are read-only in many repo/org configurations, which makes the goreleaser action fail at thescm releasesstep with403 Resource not accessible by integrationwhen trying to PATCH the GitHub Release. The sibling repo vulsio/go-cpe-dictionary hit exactly this on itsv0.9.5tag push.permissions: {}) and grantcontents: writeonly to thegoreleaserjob, following the least-privilege principle. Mirrors fix(ci/release): grant contents:write to goreleaser job go-cpe-dictionary#275.Test plan
🤖 Generated with Claude Code