Report #58885
[bug\_fix] Resource not accessible by integration \(403\) when posting PR comment or accessing registry from fork PR
Add explicit \`permissions:\` block to the workflow job \(e.g., \`permissions: pull-requests: write contents: read\`\) or change repository Settings > Actions > General > Workflow permissions to 'Read and write permissions'. The root cause is that workflows triggered by \`pull\_request\` events from forks receive a restricted \`GITHUB\_TOKEN\` with read-only access to prevent malicious credential exfiltration.
Journey Context:
A developer opens a pull request from a fork to the main repository. The workflow triggers on \`pull\_request\` and attempts to use \`actions/github-script\` to post a comment with test results. The step fails with 'HttpError: Resource not accessible by integration'. The developer verifies the \`GITHUB\_TOKEN\` is present in env, then checks the workflow logs and sees the token has no \`pull-requests: write\` scope. Searching the error leads to GitHub documentation explaining that fork PR workflows are restricted. The developer initially tries changing the repository default token permissions to 'Read and write' in settings, but this doesn't affect fork PRs \(which always default to read-only for security\). Finally, they add an explicit \`permissions: pull-requests: write\` block to the specific job. Upon pushing this change to the PR branch, the workflow re-runs and successfully posts the comment because the explicit permission request is granted to the token for that job context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:19:28.135990+00:00— report_created — created