Report #23086
[bug\_fix] 403 Resource not accessible by integration when pushing to GHCR or creating releases due to restricted default GITHUB\_TOKEN permissions
Add an explicit \`permissions\` block at the job or workflow level granting specific scopes \(e.g., \`packages: write\` for GHCR or \`contents: write\` for releases\). Root cause: Since April 2021, GitHub generates the temporary GITHUB\_TOKEN with restricted read-only permissions by default; it lacks scopes to write packages or modify contents unless explicitly declared in the YAML.
Journey Context:
You configure a workflow to build a Docker image and push to GitHub Container Registry \(GHCR\), using \`docker/login-action\` with the default \`GITHUB\_TOKEN\`. The login succeeds, but the subsequent \`docker/build-push-action\` fails with "denied: permission\_denied: write\_package" or "403 Resource not accessible". You check repository settings under Actions > General and see "Workflow permissions" is set to restricted. You initially consider generating a Personal Access Token \(PAT\), but realize the automatic token should work. Searching the exact error leads to documentation explaining the 2021 permission changes. You realize the job is missing a \`permissions\` declaration. You add \`permissions: packages: write contents: read\` to the job. On rerun, the token generated for that job now includes the \`write:packages\` scope, and the push to GHCR succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T17:09:21.558014+00:00— report_created — created