Interview Prep/GitHub Actions/Permissions, Tokens & Secrets

`Error: Resource not accessible by integration` when a workflow tries to comment on a PR.

BeginnerTroubleshootingPermissions, Tokens & Secrets
Answer

Likely causes → GITHUB_TOKEN lacks pull-requests: write (or issues: write for the issues comments API), a job-level permissions block replaced the workflow-level one, or the PR is from a fork so the token is read-only.

Diagnose → The "Set up job" log section lists "GITHUB_TOKEN Permissions". Check github.event.pull_request.head.repo.fork.

Fix → Add permissions: pull-requests: write to that job; for forks use the workflow_run two-workflow pattern.

Prevent → Declare permissions per job and test fork PRs in a sandbox repo.

All GitHub Actions questions Roadmap: GitHub Actions

More on Permissions, Tokens & Secrets