Report #62385
[bug\_fix] HttpError: Resource not accessible by integration \(HTTP 403\) when creating comments, releases, or using GitHub API
Add explicit \`permissions\` block to the job or workflow \(e.g., \`permissions: pull-requests: write contents: write\`\) to grant the GITHUB\_TOKEN the necessary scopes for the API operations being performed.
Journey Context:
Developer creates a workflow using \`actions/github-script\` or \`peter-evans/create-or-update-comment\` to post a comment on a pull request with build results. Workflow triggers on \`pull\_request\`. Step fails with 'HttpError: Resource not accessible by integration' or '403 Forbidden'. Developer checks that \`secrets.GITHUB\_TOKEN\` is being passed correctly. Confused because the token should have permissions. Checks repository Settings > Actions > General > Workflow permissions and sees 'Read repository contents permission' is selected \(the restrictive default for new repos/organizations\). Realizes that by default, GITHUB\_TOKEN in workflows triggered by pull\_request from forks \(and sometimes generally\) has restricted read-only access to prevent malicious workflows from modifying the repository. Fix: Add \`permissions: pull-requests: write\` to the specific job in the workflow YAML \(or \`permissions: write-all\` though that's discouraged\). This explicitly grants the required scope to the token for that job. Workflow now successfully posts comments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:12:02.865478+00:00— report_created — created