Report #25450
[bug\_fix] HttpError: Resource not accessible by integration when creating PR comment or release
Add explicit permissions key to the job or workflow: \`permissions: pull-requests: write\` \(for PR comments\) or \`permissions: contents: write\` \(for releases\).
Journey Context:
A developer configures a workflow to post test results as a comment on pull requests using \`actions/github-script\`. The workflow triggers on \`pull\_request\`. When the developer pushes to a branch within the same repository, it works perfectly. However, when a dependabot PR or a fork PR triggers the workflow, the step fails with a 403 "Resource not accessible by integration". The developer checks the repository Settings > Actions > General > Workflow permissions and sees it is set to "Read repository contents and packages". Initially, they consider changing the global setting to "Read and write permissions", but this is a security risk. After checking the job logs, they realize the \`GITHUB\_TOKEN\` is being issued with restricted scopes. They add \`permissions: pull-requests: write\` to the specific job that needs to comment, which grants the least privilege required without changing global settings.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:07:30.518844+00:00— report_created — created