Quick fix: Resource not accessible by integration is a 403 from the GitHub API meaning the token your step used does not have the permission that API call needs. In GitHub Actions that token is usually GITHUB_TOKEN, and personal repositories and organisations created on or after 2 February 2023 give it read-only access by default (organisation repositories inherit the organisation's setting). Add a permissions: block that grants the one write scope the step needs, for example to comment on a pull request:

jobs:
  comment:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/github-script@v9
        with:
          script: |
            await github.rest.issues.createComment({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: context.issue.number,
              body: 'Build passed'
            })

Keep contents: read in the list: once you name any permission, every permission you leave out becomes none. If the workflow runs on a pull request from a fork, this alone will not work; see the fork cause below.

The exact error

The API returns HTTP 403 with a JSON body whose message is Resource not accessible by integration. GitHub's REST troubleshooting page says that if you use a GitHub App or a fine-grained personal access token "and you receive a 'Resource not accessible by integration' or 'Resource not accessible by personal access token' error, then your token has insufficient permissions." GITHUB_TOKEN counts as a GitHub App token: the docs describe it as "a GitHub App installation access token". How the message looks depends on the tool that made the call:

# actions/github-script (Octokit)
Unhandled error: HttpError: Resource not accessible by integration - https://docs.github.com/rest/issues/comments#create-an-issue-comment

# gh api
gh: Resource not accessible by integration (HTTP 403)

# other gh commands (REST)
HTTP 403: Resource not accessible by integration (https://api.github.com/...)

# gh commands that use GraphQL
GraphQL: Resource not accessible by integration (addComment)

The github-script line is real output from Octokit (@octokit/rest 22.0.1, the client family actions/github-script wraps), run against a local mock server that returned a 403 with this message; github-script prefixes Unhandled error:, and the Octokit bundled in github-script v9 appends the docs link the API returns. The gh formats come from the GitHub CLI and go-gh source, and the GraphQL line is quoted from a public bug report about fork pull requests. The CodeQL docs also list a variant with the status in front, 403: Resource not accessible by integration, for code scanning uploads on Dependabot branches.

It appears in the failing step's log in the Actions tab. The wording comes from the API itself, not from a particular action or runner version.

Why it happens

At the start of every job GitHub creates a fresh GITHUB_TOKEN, limited to the repository that runs the workflow. Its permissions are worked out in four steps, which the workflow syntax docs spell out: start from the enterprise, organisation or repository default; apply the workflow-level permissions key; apply the job-level key; and finally, if the run was triggered by a pull request from a fork (other than pull_request_target), turn every write permission into read. Any API call outside the result fails with this 403.

The default changed on 2 February 2023. GitHub's changelog says new personal repositories and new organisations not owned by an enterprise get a read-only token, while "This change will not impact any existing enterprises, organizations or repositories." That is why the same workflow can pass in an old repository and fail in a new one.

Find your cause

Start with the log. Expand Set up job in the failing run: the runner prints a GITHUB_TOKEN Permissions group listing every scope the token actually got. Compare it with what your step needs.

CauseHow to recognise itFix
Read-only default tokenNo permissions: in the workflow; token shows only read scopes; repo or org created after 2 Feb 2023Add a permissions: block
permissions: block misses a keyThe block exists; the needed scope is absent or readAdd the key from the table below
Pull request from a forkSame workflow passes for branches in the repo, fails for fork PRspull_request_target without checking out PR code, or a separate trusted workflow
Dependabot pull requestFails only on dependabot/ branchesRaise scopes with permissions:; for CodeQL use the pull_request trigger
Org or enterprise defaultRepository's "Read and write permissions" option is greyed outUse permissions: in the workflow, which still works
Job needs more than GITHUB_TOKEN can giveCall targets another repository, the organisation, or secret scanning alertsGitHub App token or fine-grained PAT
GitHub App lacks the permissionToken comes from create-github-app-token or a botGrant the permission, approve it on the installation, add the repo

Read-only default token, or a missing key

Pick the key for what the step does, using GitHub's "Permissions required for GitHub Apps" reference:

Step does thisPermission
Comment on or label an issue or pull requestissues: write or pull-requests: write
Create or edit a pull requestpull-requests: write (plus contents: write to push the branch)
Push commits or tags, create a releasecontents: write
Publish to GitHub Packages (ghcr.io)packages: write
Upload code scanning (SARIF) resultssecurity-events: write
Create a check run / a commit statuschecks: write / statuses: write
Trigger or cancel a workflow runactions: write
Request an OIDC token for cloud loginid-token: write

The key names use hyphens. The full list in the docs is actions, artifact-metadata, attestations, checks, code-quality, contents, copilot-requests, deployments, discussions, id-token, issues, packages, pages, pull-requests, security-events, statuses and vulnerability-alerts. A typo such as pull_requests is not a valid scope; actionlint catches it (see below). Put the block on the job that needs it rather than the whole workflow; a release workflow, for example:

permissions:
  contents: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - run: gh release create "$GITHUB_REF_NAME" --generate-notes
        env:
          GH_TOKEN: ${{ github.token }}

You can also change the default instead: Settings > Actions > General > Workflow permissions, then choose Read and write permissions rather than Read repository contents and packages permissions. GitHub recommends granting the least access needed, so the per-workflow key is the better fix.

Pull requests from forks

For pull_request runs from a fork, GitHub "restricts these events to a read-only GITHUB_TOKEN", and the permissions key cannot add write access. For private repositories, an admin can enable Send write tokens to workflows from pull requests; public repositories have no such switch. For jobs that only need to call the API, such as labelling or commenting, use pull_request_target, which runs in the base repository's context and gets a read/write token even for forks. Do not check out or run the pull request's code in that job; GitHub's security guidance warns that doing so can expose secrets and write access:

on:
  pull_request_target:
    types: [opened]

permissions:
  pull-requests: write

jobs:
  label:
    runs-on: ubuntu-latest
    steps:
      # No checkout of the PR's code: this job only calls the API.
      - run: gh pr edit "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --add-label "needs-review"
        env:
          GH_TOKEN: ${{ github.token }}
          PR_NUMBER: ${{ github.event.pull_request.number }}

Dependabot pull requests

The docs say runs triggered by Dependabot pull requests "use a read-only GITHUB_TOKEN" by default and that "You can use the permissions key in your workflow to increase the access for the token." For CodeQL, GitHub's troubleshooting page for 403: Resource not accessible by integration recommends running on pull_request rather than push for Dependabot branches, because code scanning "always allows the uploading of results when the pull_request event triggers the action run", or excluding dependabot/** from push.

Organisation or enterprise default

If an organisation or enterprise selects the restricted default, repositories inherit it and "the permissive option is disabled". This only sets the starting point: the enterprise docs state that anyone with write access "can still modify the permissions granted to the GITHUB_TOKEN for a specific workflow, by editing the permissions key". So add the key rather than waiting for an owner to change the setting.

The job needs more than GITHUB_TOKEN can give

GITHUB_TOKEN only works on its own repository, and some resources are outside its list entirely (the docs note secret scanning alerts "require a GitHub App or a personal access token"). For another repository or the organisation, create a GitHub App token in the workflow, as GitHub's docs recommend:

steps:
  - uses: actions/create-github-app-token@v3
    id: app-token
    with:
      client-id: ${{ vars.APP_CLIENT_ID }}
      private-key: ${{ secrets.APP_PRIVATE_KEY }}
      owner: ${{ github.repository_owner }}
      repositories: other-repo
      permission-issues: write
  - run: gh issue create --repo "$GITHUB_REPOSITORY_OWNER/other-repo" --title "Sync" --body "From $GITHUB_REPOSITORY"
    env:
      GH_TOKEN: ${{ steps.app-token.outputs.token }}

A GitHub App lacks the permission

An app token can never exceed the app's installation. The action's README says the token "inherits all of the installation's permissions" by default, and the permission-<name> inputs only narrow it. Check three things: the app's settings grant the permission; the account owner approved it (when an app asks for more, "the GitHub App will still retain its current permissions" until someone accepts); and the installation includes the target repository. The response's X-Accepted-GitHub-Permissions header lists what the endpoint needs, for example pull_requests=write,contents=read; gh api -i prints it.

Check it is fixed

Lint the workflow locally, then re-run the job:

actionlint .github/workflows/pr-comment.yml

No output means no problems. actionlint flags typos such as unknown permission scope "pull_requests", but its built-in list can lag the docs, so trust the docs list above. In the new run, Set up job > GITHUB_TOKEN Permissions should list the write scope, and the step should finish green. For a fork-only problem, test with a pull request from a fork, not a branch.

  • Resource not accessible by personal access token: the same problem with a fine-grained PAT. Edit the token's repository access and permissions.
  • GraphQL: Resource not accessible by integration (addComment): the GraphQL form, printed by gh commands. Same fixes; the name in brackets is the failed mutation.
  • 403: Resource not accessible by integration: GitHub's documented CodeQL variant on Dependabot branches; fix with the trigger change above.
  • GitHub Actions is not permitted to create or approve pull requests: a different setting. Enable Allow GitHub Actions to create and approve pull requests under Workflow permissions (off by default for new repositories and organisations).

What to do next

FAQ

Why did my workflow work in one repository but not another?

The default token permissions differ. Personal repositories and organisations created on or after 2 February 2023 default to read-only, older ones usually to read and write, and organisation repositories follow the organisation. An explicit permissions: block makes the workflow behave the same everywhere.

Should I just enable "Read and write permissions" for the repository?

It works, but every workflow then gets write access. GitHub advises granting the least required access, so add permissions: to the jobs that need it.

How do I fix Resource not accessible by integration on pull requests from forks?

Write permissions are stripped for fork pull requests. Move the API call into a pull_request_target job that never checks out the fork's code, or into a separate workflow on a trusted trigger.

Does write-all fix it?

For most same-repository calls, yes, but it over-grants. It will not help on fork pull requests or for resources GITHUB_TOKEN cannot reach.

How this fix was verified

Run here on 14 November 2026 on macOS 26.5 on Apple M4: the Octokit error format, using @octokit/rest 22.0.1 (with @octokit/request-error 7.1.2) in a local npm project against a mock server on 127.0.0.1 that returned the documented 403 body (the server was closed after the run; no request reached GitHub); and every workflow in this article, validated with actionlint 1.7.12 (installed in a Python venv) plus a YAML parse. actionlint passed the examples except the create-github-app-token@v3 step, where its bundled metadata still expects the deprecated app-id input; the action's own action.yml at v3.3.0 lists client-id, so we follow that.

Checked against docs and source only, not executed: no workflow was run and no repository or GitHub App was created. The permission names, defaults, fork, Dependabot and policy behaviour come from the github/docs source (docs.github.com) and the 2 February 2023 changelog; the gh formats from the cli/cli and cli/go-gh source; the log group from the actions/runner source; and the GraphQL line from a public issue.

Last verified: 14 November 2026.

We re-check this fix monthly and record any change in this page's changelog.