Fix: Resource not accessible by integration and other GitHub Actions permission errors
A workflow step fails with Resource not accessible by integration, 403 on git push, or a GitHub CLI call is refused. The GITHUB_TOKEN lacks a scope, the event provides a read-only token, or the action was never allowed.
Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?
A step that calls the GitHub API, pushes a commit, comments on a pull request or publishes a package fails with one of these:
RequestError [HttpError]: Resource not accessible by integration
remote: Permission to acme/app.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/acme/app/': The requested URL returned error: 403
HTTP 403: Resource not accessible by integration (https://api.github.com/repos/acme/app/issues/42/comments)
The “integration” in the message is the GitHub Actions app itself. Its per-run GITHUB_TOKEN did not have the permission the call needed. There are four places that decide what the token can do; check them in this order.
Cause 1: the workflow does not request the scope
Since 2023 new repositories give GITHUB_TOKEN read-only access by default. Anything that writes needs an explicit permissions block, at the top level or on the job:
permissions:
contents: write
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr comment "$PR" --body "Build finished"
Match the scope to the action: contents: write to push commits, create releases or tags; pull-requests: write to comment on or label pull requests; issues: write for issues; packages: write to publish to GitHub Packages or ghcr.io; pages: write plus id-token: write for Pages deployments; checks: write to publish check runs; security-events: write to upload code scanning results. The full list is in the documentation linked below. Once you set any permissions block, every scope you do not name becomes none, so a job that worked before can break when you add a block elsewhere; set contents: read explicitly if steps still need to check out code.
Cause 2: the repository or organization caps the token
Settings > Actions > General > Workflow permissions has two settings: Read repository contents and packages permissions (the default) or Read and write permissions, and a checkbox Allow GitHub Actions to create and approve pull requests. The workflow’s permissions block can only narrow what this setting allows, never widen it; if the organization setting is read-only, a repository cannot override it. If your workflow needs to open pull requests, the checkbox must be ticked regardless of the YAML.
Cause 3: the event only grants a read-only token
pull_requestfrom a fork: the token is read-only and secrets are not available, by design, because the pull request contains untrusted code. Steps that need to write (post a comment, upload coverage) must move to a second workflow triggered byworkflow_runorpull_request_target, which runs in the base repository’s context. Never check out and execute the pull request’s code in apull_request_targetworkflow; that hands write access to anyone who opens a pull request.- Dependabot pull requests: the token is read-only and only Dependabot secrets are available. Guard writing steps with
if: github.actor != 'dependabot[bot]'or give them a separate workflow. scheduleandworkflow_dispatchrun on the default branch with full configured permissions; if those fail, it is cause 1 or 2.
Cause 4: the token cannot do it at all
- Commits, tags and releases created with
GITHUB_TOKENdo not trigger other workflows. If your release workflow is supposed to start a deploy workflow and nothing happens, that is why, and no permission fixes it. Use a GitHub App installation token (for example withactions/create-github-app-token) or a fine-grained personal access token stored as a secret. - Access to other repositories: the token is scoped to the current repository. Checking out a private sibling repository or pushing to another one needs a deploy key or a token with access to both.
- Editing files under
.github/workflows/needs theworkflowsscope, whichGITHUB_TOKENnever has; the push fails with refusing to allow a GitHub App to create or update workflow. actions/checkoutstores the token in the repository’s Git config by default (persist-credentials: true), so a latergit pushuses it. If you setpersist-credentials: false, that push has no credentials and fails with 403 even with the right scopes.
How to see what the token has
Every job log starts with a collapsed Set up job section that lists GITHUB_TOKEN Permissions with the effective scopes after all four causes are applied. Open it before changing anything; it tells you whether the problem is the YAML (the scope is missing) or the event (the scope is present but marked read).
- name: Show token scopes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/${{ github.repository }} --jq .permissions
gh api rate_limit --jq .rate
The first call shows what the token may do on this repository; the second confirms the token authenticates at all (an unauthenticated call has a much lower rate limit).
Checklist
- Read the GITHUB_TOKEN Permissions list in Set up job.
- Add the missing scope to a
permissionsblock on the job that needs it, keep every other scope minimal. - Confirm the repository and organization Workflow permissions setting allows it, and tick create and approve pull requests if needed.
- If the run came from a fork or Dependabot, move the writing step to a
workflow_runworkflow or skip it there. - If the action must trigger another workflow or touch another repository, switch to a GitHub App token or a fine-grained PAT.
Official documentation
Did this work for you?
No votes yet. Be the first.
If it did not work, the report form below tells the editors what went wrong.
See also
- 0039 A minimal GitHub Actions workflow that runs your tests Add one YAML file under .github/workflows and GitHub runs your tests on every push and pull request. Here is a small, explained… Intermediate · Step by step · Any system Article GitHub Actions 15 Oct 2026
- 0256 Manage infrastructure as code with Terraform: from first file to plans on pull requests Learn the full Terraform workflow without a cloud account: variables, a module, outputs, state, plan, apply and destroy, a backend for shared… Beginner · Guided project · Linux, macOS, Windows Article GitHub Actions · Terraform 15 Oct 2026
- 0379 Your first GitHub Actions workflow: run tests on every push Build a working GitHub Actions pipeline from nothing: a small Python project with a test, a workflow file that runs pytest on… Beginner · Guided project · Any system Article GitHub Actions · Pipelines, runners & hooks 15 Oct 2026
- 0380 GitHub Actions cheat sheet: triggers, matrix, secrets, caching The GitHub Actions syntax you reach for most, in copy-ready blocks: event triggers and filters, build matrices, secrets and permissions, dependency caching… Intermediate · Cheat sheet · Any system Article GitHub Actions 15 Oct 2026
Repos in the wild
- act: run your GitHub Actions workflows locally with Docker nektos/act The nektos/act repository: a command-line tool that reads .github/workflows, simulates GitHub events and runs the jobs in Docker containers on your machine, so you can test a workflow without pushing. GitHub
History
Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.
- Dominik +5,705 chars