"Resource not accessible by integration" is a 403 from the GitHub API meaning the token your workflow used, almost always the automatic GITHUB_TOKEN, doesn't have the permission that endpoint needs. Fix it by adding a permissions: block that grants the specific scope (for example pull-requests: write to comment on a PR). If it still fails, the run is from a fork or Dependabot and the token was forced read-only, an org setting caps it, or the API is out of GITHUB_TOKEN's reach entirely and needs a GitHub App token.
"Integration" is GitHub's old word for a GitHub App, and GITHUB_TOKEN is a GitHub App installation token. A fine-grained personal access token with the same problem says "Resource not accessible by personal access token" instead. Everything below was checked against docs.github.com in December 2026.
What the Error Looks Like
From actions/github-script or any Octokit-based action:
RequestError [HttpError]: Resource not accessible by integration
status: 403,
url: 'https://api.github.com/repos/acme/web/issues/412/comments'
From the GitHub CLI in a run: step:
HTTP 403: Resource not accessible by integration (https://api.github.com/repos/acme/web/issues/412/labels)
The URL is the most useful part. It tells you which endpoint failed, and every REST endpoint's documentation lists exactly which permission it needs.
Why GITHUB_TOKEN Is Read-Only by Default
Two settings decide what the token can do before your workflow file is even read.
The default workflow permissions setting. Under Settings, Actions, General, "Workflow permissions" has two options: read and write for all permissions (permissive), or read access to the contents and packages permissions only (restricted). Per the repository Actions settings docs, new repositories in a personal account start restricted, and repositories in an organization inherit the org setting. If an org or enterprise chooses restricted, the repository can't switch to permissive.
That restricted default is the root of most of these errors. Restricted gives you contents: read, so checkout works, but issues, pull-requests, checks and everything else are effectively none. The first time a workflow tries to comment, label or create a release, it gets a 403.
The order permissions are calculated in. The workflow syntax reference describes it: start from the enterprise, org or repo default; apply the workflow-level permissions; apply the job-level permissions; and finally, for a pull request from a fork (other than pull_request_target), downgrade any write permission to read unless the "Send write tokens to workflows from pull requests" setting is on.
Fix Resource Not Accessible by Integration with a permissions Block
Grant exactly what the job needs, at the job level:
name: pr-report
on: pull_request
jobs:
report:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
- run: ./scripts/build-report.sh > report.md
- name: Comment on the PR
env:
GH_TOKEN: ${{ github.token }}
run: gh pr comment ${{ github.event.pull_request.number }} --body-file report.md
The "everything else becomes none" trap
The rule that bites people: if you specify any permission, every permission you don't list is set to none. A workflow that worked under the permissive default breaks the moment someone adds permissions: { id-token: write } for OIDC, because contents silently drops to none and checkout of a private repository fails. Always list contents: read alongside whatever else you add. The same applies when you set up GitHub Actions OIDC for cloud deploys.
Avoid permissions: write-all. It hides the problem today and turns any compromised action in the job into a repo-wide write credential tomorrow.
Which Permission Each API Call Needs
These come from the "Fine-grained access tokens" section of each endpoint's REST docs, which applies to GITHUB_TOKEN as an installation token. The permissions: key names use hyphens.
| What the step does | Endpoint | permissions: needed |
|---|---|---|
| Comment on an issue or PR | POST /repos/{o}/{r}/issues/{n}/comments |
issues: write or pull-requests: write |
| Add labels to an issue or PR | POST /repos/{o}/{r}/issues/{n}/labels |
issues: write or pull-requests: write |
| Open a pull request | POST /repos/{o}/{r}/pulls |
pull-requests: write (plus a repo setting, below) |
| Create a release | POST /repos/{o}/{r}/releases |
contents: write |
| Push commits or tags | git push | contents: write |
| Trigger another workflow | POST .../workflows/{id}/dispatches |
actions: write |
| Create a check run | POST /repos/{o}/{r}/check-runs |
checks: write |
| Set a commit status | POST /repos/{o}/{r}/statuses/{sha} |
statuses: write |
| Create a deployment | POST /repos/{o}/{r}/deployments |
deployments: write |
| Push to GitHub Container Registry | registry push | packages: write |
| Upload code scanning SARIF | code scanning API | security-events: write |
| Request an OIDC token | runtime token endpoint | id-token: write |
Sources: issue comments, labels, pulls, releases, workflow dispatch, check runs, statuses, deployments.
Two quirks worth knowing. Pull request comments and labels go through the Issues API, which is why either issues: write or pull-requests: write works for them. And check runs can be created by GitHub App tokens (including GITHUB_TOKEN) but not by fine-grained personal access tokens, so a PAT is not a fix there.
The current permission list also includes newer keys such as artifact-metadata, code-quality, copilot-requests and vulnerability-alerts (read Dependabot alerts; read or none only). If an action's README asks for one you don't recognise, check the syntax reference rather than guessing.
Debug the Missing Permission with X-Accepted-GitHub-Permissions
You don't have to guess. For GitHub App and fine-grained tokens, the REST API returns an X-Accepted-GitHub-Permissions header listing the permissions the endpoint accepts. The REST troubleshooting docs explain the format: a comma-separated list means all are required, and a semicolon separates alternative sets. For example, pull_requests=read,contents=read; issues=read,contents=read means either pull requests plus contents, or issues plus contents.
Note the header uses underscores (pull_requests) while the workflow key uses a hyphen (pull-requests).
Add a temporary debug step that replays the failing call with headers:
- name: Show required permissions
if: failure()
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api -i -X POST \
"repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" \
-f 'labels[]=needs-review' 2>&1 \
| grep -iE '^(HTTP|x-accepted-github-permissions)' || true
The if: failure() guard keeps the step from running, and burning runner time on private repos, when nothing is wrong; our breakdown of GitHub Actions pricing in 2026 explains how those minutes are billed now. Then map each name=level pair to the hyphenated key in your permissions: block. If the header is missing or the permission it names isn't one GITHUB_TOKEN can have, you are in the "needs an App token" case below.
Fork Pull Requests and pull_request_target Risks
A workflow triggered by pull_request from a fork gets a read-only GITHUB_TOKEN and no repository secrets, whatever your permissions: block says. This is deliberate: the workflow runs code from the fork's merge commit, written by someone without write access. You'll see the error the first time an outside contributor opens a PR against a workflow that comments on PRs.
The tempting fix is to switch to pull_request_target, which runs with the base repository's token (read/write) and secrets. It is safe only as long as you never run code from the pull request. GitHub's guide to securely using pull_request_target shows the insecure pattern, a "pwn request":
# INSECURE: runs the fork's Makefile with your secrets and a write token
on: pull_request_target
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
- run: make test
Two recent platform changes are aimed squarely at this:
- actions/checkout v7 blocks it. Version 7.0.0 refuses to check out fork pull request code in
pull_request_targetandworkflow_runworkflows unless you setallow-unsafe-pr-checkout: true, a name chosen to stand out in review. - A default policy blocks pull_request_target in public repositories. GitHub added a default Actions event policy that blocks the event in public repos without their own applicable policy. It ran in evaluate mode first, and the docs state that on December 2, 2026 GitHub enforces it for affected repositories that were on the default policy before general availability. Private and internal repositories are not affected. If a public repo's triage or labeling workflow suddenly stops running this week, that is the likely reason, and the fix is an explicit event policy that allows it, only if you really need it.
The safer pattern: split untrusted and privileged work
For "build the PR, then comment results", use two workflows:
- A
pull_requestworkflow builds and tests with a read-only token, and uploads the results (say,report.mdand the PR number) as an artifact. - A
workflow_runworkflow, triggered when the first completes, haspull-requests: write, downloads the artifact, and posts the comment.
Treat the artifact as untrusted data. Never execute anything from it, and validate the PR number is an integer before using it in an API call.
Dependabot Pull Requests
Workflows triggered by Dependabot on push, pull_request, pull_request_review or pull_request_review_comment are treated like forks: read-only GITHUB_TOKEN and no normal secrets. Unlike forks, the Dependabot troubleshooting docs say the permissions key can raise the token's scope for these runs, and secrets must be stored as Dependabot secrets:
on: pull_request
permissions:
contents: write # enabling auto-merge needs contents as well
pull-requests: write
jobs:
automerge:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- env:
GH_TOKEN: ${{ github.token }}
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
Organization and Repository Settings That Override Your Workflow
If your permissions: block is right and you still get 403, check settings:
- Org or enterprise restricted default. Your workflow can still grant scopes explicitly, but owners can also restrict write access for the token at the repository level.
- "Allow GitHub Actions to create and approve pull requests." Off by default for new personal repos and inherited from the org otherwise. With it off, opening a PR fails with
GitHub Actions is not permitted to create or approve pull requestseven withpull-requests: write. - "Send write tokens to workflows from pull requests." Only relevant to private repos with fork workflows; leave it off unless you trust every fork author.
- Nested reusable workflows. Permissions can only stay the same or get narrower down the chain, per the reusable workflows reference. If a called workflow needs
issues: write, the caller must grant it.
When GITHUB_TOKEN Can't Do It: GitHub Apps vs PATs
GITHUB_TOKEN is scoped to the repository running the workflow and can't be given some permissions at all. Common cases:
- Writing to another repository (bumping a version in a config repo, opening a PR elsewhere).
- Organization-level APIs such as team membership or org-owned Projects.
- Changing files under
.github/workflows/. There is noworkflowskey inpermissions:, so pushes that touch workflow files are rejected withrefusing to allow a GitHub App to create or update workflow ... without workflows permission. - Triggering other workflows with your push. Events caused by
GITHUB_TOKENdon't start new runs, apart fromworkflow_dispatchandrepository_dispatch. Per the GITHUB_TOKEN concepts page, pull requests it opens or updates now create runs that wait for approval from a user with write access.
For these, use a GitHub App installation token rather than a personal access token. An App's token is short-lived, scoped to the repositories you install it on, isn't tied to a person who might leave, and can be narrowed per job:
- uses: actions/create-github-app-token@v3
id: app-token
with:
client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
owner: acme
repositories: config-repo
permission-contents: write
permission-pull-requests: write
- env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: gh pr create --repo acme/config-repo --head bump-web-1.42.0 --title "Bump web to 1.42.0" --body "Automated bump"
The action's app-id input is deprecated in favour of client-id. Fine-grained PATs are acceptable for a personal repo or a quick fix, but they belong to a human, expire on a schedule someone forgets, and can't create check runs. Avoid classic PATs with repo scope; they grant access to every repository the user can reach. Long-lived tokens in CI are also one of the paths supply-chain attacks use, the same reason we recommend registry controls like the GitHub package firewall for npm.
Frequently Asked Questions
What does "integration" mean in this error?
It is GitHub's older name for a GitHub App. The GITHUB_TOKEN in Actions is an installation token for a GitHub App that GitHub installs on your repository, so permission failures with it, or with any other GitHub App token, read "Resource not accessible by integration". A fine-grained personal access token produces "Resource not accessible by personal access token" instead.
Why did my workflow break after I added a permissions block?
Specifying any permission sets every unlisted permission to none. If you add id-token: write or pull-requests: write alone, contents drops to none and steps like checkout of a private repo, or reading releases, start failing. List every scope the job uses, starting with contents: read.
Can I give write permissions to workflows from forked pull requests?
Not with pull_request in public repos; the token is downgraded to read-only. Use a two-workflow pattern (pull_request to build, workflow_run to post results) or, if you must, pull_request_target without ever executing the PR's code. In public repositories, GitHub's default policy blocking pull_request_target is enforced from December 2, 2026 for repos still on that default.
How do I find which permission an API call needs?
Read the endpoint's REST documentation, which lists the required fine-grained permission sets, or replay the failing request with gh api -i and read the X-Accepted-GitHub-Permissions response header. Translate its underscore names, such as pull_requests=write, into the hyphenated workflow keys, such as pull-requests: write.
Should I use a personal access token instead of GITHUB_TOKEN?
Only when GITHUB_TOKEN can't do the job, such as cross-repository writes, organization APIs or editing workflow files. Even then, prefer a GitHub App installation token created per job with actions/create-github-app-token: it is short-lived, scoped to specific repositories and permissions, and not tied to an individual's account.
Bottom Line
Treat "Resource not accessible by integration" as a missing scope, not a mystery. Find the failing endpoint in the error URL, grant that one permission at the job level (keeping contents: read), and use X-Accepted-GitHub-Permissions when the docs are ambiguous. If the run came from a fork or Dependabot, change the workflow design rather than the token, and keep pull_request_target away from untrusted code, especially now that GitHub blocks it by default in public repos. When the job needs to reach beyond the repository, switch to a scoped GitHub App token instead of a personal one.