Report #35540
[bug\_fix] Resource not accessible by integration \(403\) when posting PR comment or pushing to protected branch
Add explicit permissions block to the workflow YAML \(e.g., \`permissions: pull-requests: write\`\) or change the repository default from "Read repository contents" to "Read and write permissions" under Settings > Actions > Workflow permissions.
Journey Context:
A developer creates a workflow that uses \`actions/github-script\` to post a comment on a pull request. The workflow fails instantly with a 403 "Resource not accessible by integration" error. The developer checks the GITHUB\_TOKEN secret and confirms it is not empty. They try using a PAT with repo scope, which works, proving the API call itself is valid. Suspecting a permission issue, the developer navigates to the repository Settings, then Actions > General, and discovers "Workflow permissions" is set to "Read repository contents and packages permissions" \(the default for new repositories since February 2023\). The developer changes this to "Read and write permissions" and re-runs the workflow, which now succeeds. Alternatively, the developer learns that adding \`permissions: pull-requests: write\` at the job or workflow level explicitly grants the required OAuth scope without changing the global repository default, making the workflow portable and secure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:07:05.152035+00:00— report_created — created