Report #78943
[bug\_fix] Resource not accessible by integration when posting PR comments or creating releases from fork PRs
Change the workflow trigger from \`pull\_request\` to \`pull\_request\_target\` \(which runs in the base repository context with write permissions\), or use a two-workflow pattern where \`workflow\_run\` triggers after the \`pull\_request\` workflow completes. Root cause: Workflows triggered by \`pull\_request\` events from forks receive a read-only \`GITHUB\_TOKEN\` to prevent malicious exfiltration of secrets or unauthorized repository modifications by untrusted fork code.
Journey Context:
A developer configures a workflow that posts a deployment preview link as a PR comment using \`actions/github-script\`. It works perfectly for internal branches, but when an external contributor opens a PR from their fork, the job fails with "HttpError: Resource not accessible by integration". The developer checks the job logs and sees \`permissions: read-all\` for the token. They try explicitly setting \`permissions: pull-requests: write\` but it still fails. After searching GitHub issues, they discover that for security, fork PRs cannot receive write tokens on \`pull\_request\` events. They realize they must use \`pull\_request\_target\`, which runs in the base repo context with access to secrets and write permissions, but they must carefully checkout the base ref first to avoid executing untrusted code from the fork with elevated privileges.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:06:05.979757+00:00— report_created — created