'Resource not accessible by integration' in a GitHub Actions step
Resource not accessible by integrationShort answer
The GITHUB_TOKEN of the run lacks the permission the API call needs. Grant it in the permissions key. On pull requests from forks and Dependabot the token is read-only whatever you write, so label, comment or push from a workflow that runs on pull_request_target or workflow_run, with care.
Fix it fast
1Find out which cause you have
Check which event started the run and which permissions the job has. The same step can pass on a push and fail on a pull request.
grep -n -E '^on:|pull_request|permissions:' .github/workflows/*.yml2Match what you see, then jump to its fix
- 1
The workflow starts on push or in the same repository, and the call writes (comment, label, release, status)The job does not grant the permission the call needsFix - 2
It works on your own branches and fails only on forked or Dependabot pull requestsThe pull request comes from a fork or from DependabotFix - 3
The permission is already write and the call still failsThe call needs more than GITHUB_TOKEN can ever haveFix - 4
A job with no permissions block fails when it was copied from a repository that had write defaultsWorkflow permissions are set to read-only and the job relies on the defaultFix
- 1
What does the error look like?
Resource not accessible by integrationHttpError: Resource not accessible by integration
Cause 1 of 4
The job does not grant the permission the call needs
1Check
Each permission is read, write or none, and any permission you leave out of a permissions block is none. The repository default can also be restricted to read-only contents and packages.
grep -n -B1 -A6 'permissions:' .github/workflows/*.yml2Fix
Add the narrowest write permission the call needs, for example pull-requests: write to comment on a PR or issues: write to label an issue.
permissions:
contents: read
pull-requests: write3Verify
Re-run the job; the API call succeeds.
gh run rerun --failedConfirmed by docs.github.com
Cause 2 of 4
The pull request comes from a fork or from Dependabot
1Check
GITHUB_TOKEN has read-only permissions in pull requests from forked repositories, secrets are not passed to the runner, and Dependabot pull requests are treated as forks.
gh pr view PR_NUMBER --json isCrossRepository,author2Fix
Keep the pull_request workflow for build and tests. Move the write step (label, comment) to a workflow on pull_request_target, which runs in the base repository's context. Never check out or run the pull request's code in that workflow.
on:
pull_request_target:
types: [opened]
permissions:
pull-requests: write
jobs:
label:
runs-on: ubuntu-24.04
steps:
- uses: actions/github-script@v7
with:
script: |
await github.rest.issues.addLabels({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: context.issue.number, labels: ['needs-review']
})3Verify
Open a test pull request from a fork and watch the label appear.
gh pr view PR_NUMBER --json labelsConfirmed by docs.github.com
Cause 3 of 4
The call needs more than GITHUB_TOKEN can ever have
1Check
The token can only do what its permissions allow. For access beyond that, GitHub suggests a GitHub App installation token, or a personal access token kept as a secret.
grep -n 'secrets\.' .github/workflows/*.yml2Fix
Create a GitHub App, install it on the repositories you need, and generate an installation token in the job. Use a personal access token only if an App is not an option.
# pass the App token to the step instead of github.token
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}3Verify
The call that failed now returns success.
gh run rerun --failedConfirmed by docs.github.com
Cause 4 of 4
Workflow permissions are set to read-only and the job relies on the default
1Check
A new personal repository gives GITHUB_TOKEN read access for contents and packages only; organizations inherit their own setting. Creating pull requests also has its own switch.
grep -n 'permissions:' .github/workflows/*.yml || echo 'no permissions block: repository default applies'2Fix
Prefer an explicit permissions block in the workflow. If you need the repository default changed, use Settings, Actions, General, Workflow permissions (and the create-and-approve pull requests box if the job opens PRs).
permissions:
contents: write3Verify
Re-run the job; the call that was refused now passes.
gh run rerun --failedConfirmed by docs.github.com
How do I stop it coming back?
- Write a permissions block on every workflow and give each job only what it uses.
- Never run code from a fork's pull request in a workflow that has write access.
- Set the repository default to read-only so missing permissions show up early.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Servers
A GitHub Actions push or API call fails with permission denied to github-actions[bot]
Permission denied to github-actions[bot]
The GITHUB_TOKEN carries only the permissions the workflow gives it.
4 causes, each with a fixServers
Docker push to Artifact Registry fails from GitHub Actions with a permission error
Permission 'artifactregistry.repositories.uploadArtifacts' denied on resource
The identity your workflow authenticates as lacks the permission artifactregistry.repositories.uploadArtifacts on the target repository.
4 causes, each with a fixServers
docker pull or push to ghcr.io fails with 'denied'
Error response from daemon: denied
ghcr.io refuses a pull or push when Docker is not logged in, when the token lacks the package scope, or when the workflow's GITHUB_TOKEN has no packages permission or no access to that package.
4 causes, each with a fixServers
git says it could not read Username for https://github.com in a build or CI job
fatal: could not read Username for 'https://github.com': No such device or address
Git asked for HTTPS credentials and there was no terminal to ask on, so it gave up.
3 causes, each with a fixServers
upload-artifact fails because the artifact storage quota is full
Create Artifact Container failed: Artifact storage quota has been hit. Unable to upload any new artifacts
Uploads fail when your account's shared artifact storage is used up.
3 causes, each with a fixServers
configure-aws-credentials says no OpenID Connect provider exists for GitHub
No OpenIDConnect provider found in your account for https://token.actions.githubusercontent.com
AWS has no IAM identity provider for GitHub's token issuer in the account that holds the role.
3 causes, each with a fix