Skip to content

Resource not accessible by integration: GITHUB_TOKEN lacks permissions

CI/CDtested on GitHub Actions, gh 2.103.3

Every workflow run gets a GITHUB_TOKEN whose rights are set by permissions. If the top only says contents: read, the job may do nothing else – an API call that needs more fails with 403 “Resource not accessible by integration”.

Symptom

gh run view <ID> --log-failed | grep -o 'HTTP 403.*'
HTTP 403: Resource not accessible by integration (https://api.github.com/repos/<du>...

The job wants to create a label with gh label create. The workflow has permissions: contents: read.

Diagnosis

Look at the workflow's permissions – they apply to every job without its own entry.

permissions:
  contents: read
    GH_TOKEN: ${{ github.token }}
  run: gh label create "wk-$GITHUB_RUN_ID" --repo "$GITHUB_REPOSITORY"

Causes

contents readToken with read access only

Labels belong to issues. With contents: read the token may not create issues or labels.

integration“integration” means the run's token

The message comes from the GitHub API and refers to the GITHUB_TOKEN of the Actions app – not to your own access.

Fix

Give the job the one missing permission.
permissions:
      issues: write
gh label list --search wk-
wk-41633979173               #5319E7

Don't: Set permissions to write-all at the top – then every job may do everything, including jobs that run foreign code.

▶
Break it yourself and find it – free
GitHub Actions hands-on, Day 15: find and fix eight broken workflows against the clock.
Go to day 15 →

FAQ

Which permission do I need for what?

For example issues for issues and labels, pull-requests for PR comments, packages for GHCR, id-token for OIDC – only what the job actually does.

Why per job instead of for the workflow?

The rights then apply only where they are needed; all other jobs keep contents: read.

Related error patterns

More