Report #9304
[bug\_fix] Resource not accessible by integration \(403\) when creating releases, packages, or GitHub Releases using GITHUB\_TOKEN
Add an explicit permissions block to the workflow job: \`permissions: contents: write\` \(or packages: write for GHCR\). Root cause: Default GITHUB\_TOKEN permissions were restricted to read-only for certain scopes; explicit declaration is required to grant write capabilities even if repository settings suggest otherwise.
Journey Context:
A developer configures a workflow to automatically create a GitHub Release when a tag is pushed, using \`gh release create\`. The workflow triggers on \`push: tags: \[ 'v\*' \]\`, checks out the code, and calls the CLI. The job fails immediately with "HTTP 403: Resource not accessible by integration". The developer first suspects the \`gh\` CLI needs authentication, but confirms \`GITHUB\_TOKEN\` is automatically available. They try explicitly setting \`GITHUB\_TOKEN: $\{\{ secrets.GITHUB\_TOKEN \}\}\` in the job env, but the error persists. They navigate to Settings > Actions > General and verify "Workflow permissions" is set to "Read and write permissions", yet the error continues. After searching GitHub Issues, they discover that for fine-grained security, the repository setting is insufficient; the workflow YAML itself must explicitly declare the required OAuth scopes via the \`permissions\` key. By adding \`permissions: contents: write\` at the job level, the token is granted the necessary scope to create releases, immediately resolving the 403 error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:47:54.778598+00:00— report_created — created