fix: add permissions to npm-publish job to allow semantic-release to create GitHub releases#124
Closed
fix: add permissions to npm-publish job to allow semantic-release to create GitHub releases#124
Conversation
…ases Co-authored-by: missinglink <738069+missinglink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] why did this job fail?
https://github.com/pelias/spatial/actions/runs/18126994658/job/51584734348
fix: add permissions to npm-publish job to allow semantic-release to create GitHub releases
Sep 30, 2025
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.
Problem
The
npm-publishjob was failing with a 404 error when semantic-release attempted to create a GitHub release:See the failed job: https://github.com/pelias/spatial/actions/runs/18126994658/job/51584734348
The package was successfully published to npm, but the workflow failed before completing the GitHub release creation step.
Root Cause
GitHub Actions requires explicit
permissionsdeclarations at the job level to allow operations like creating releases, even when using a personal access token with the appropriate OAuth scopes. Without these explicit permissions, GitHub Actions denies the operation as a security measure.The
GH_SEMANTIC_RELEASE_TOKENhad the correct OAuth scopes (repo,user:email,workflow,write:repo_hook), but the workflow lacked the job-level permission configuration needed for semantic-release to create releases via the GitHub API.Solution
Added explicit permissions to the
npm-publishjob:These permissions enable semantic-release to:
Impact
This is a minimal, surgical fix that only adds 4 lines to the workflow configuration. With this change, future releases on the master branch will successfully create GitHub releases after publishing to npm, completing the full semantic-release workflow.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.