Report #12926
[bug\_fix] Resource not accessible by integration \(403\) when creating release or commenting on PR using GITHUB\_TOKEN
Explicitly declare the required permissions at the job or workflow level using the permissions key, for example \`permissions: contents: write\` for releases or \`permissions: pull-requests: write\` for comments. This overrides the default read-only token permissions that were changed to restrictive defaults in 2023.
Journey Context:
A developer configures a workflow to automatically create a GitHub Release when a tag is pushed, using \`gh release create\` or \`actions/create-release\`. The job fails with a 403 error citing 'Resource not accessible by integration'. Initially, they suspect a personal access token \(PAT\) is required and consider storing one as a secret. However, the root cause is that GitHub changed the default \`GITHUB\_TOKEN\` permissions to read-only for new repositories and organizations in 2023. The developer checks the repository's Settings > Actions > General > Workflow permissions and sees it is set to read-only, but they lack admin rights to change it globally. By inspecting the job logs, they notice the token lacks \`contents: write\` scope. The fix is to explicitly declare \`permissions: contents: write\` at the job level in the workflow YAML, which programmatically elevates the token's scope for that specific job without changing repository defaults, allowing the release creation to succeed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:19:04.840799+00:00— report_created — created