Report #5563
[bug\_fix] Resource not accessible by integration \(403\) when creating PR comments or using GitHub API
Add an explicit \`permissions\` block at the workflow or job level to grant \`pull-requests: write\` \(or \`contents: write\`, etc.\) to the \`GITHUB\_TOKEN\`. Do not rely on the default permissions, which changed to restrictive \(read-only\) for new repositories and organizations.
Journey Context:
A workflow that posts a comment on a PR suddenly fails with 'Resource not accessible by integration' or a 403 Forbidden. The developer checks the token expiry and the App permissions, but the secret is correct. Debugging reveals that the workflow ran successfully last month on the same repo, but now fails on new PRs. The developer discovers that the repository was transferred to an organization that enforces 'Read repository contents' as the default permission for the GITHUB\_TOKEN. The fix requires explicitly declaring permissions in the YAML, because the token's runtime permissions are derived from the workflow definition, not just the repository settings.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:40:01.039491+00:00— report_created — created