GitHub Action error Resource not accessible by integration when attempting to upload SARIF report files to GitHub

Just a very quick blog post to show a potential fix for GitHub Action error Resource not accessible by integration when attempting to upload SARIF report files to GitHub, I came across this when attempting to use GitHub action github/codeql-action/upload-sarif@v3

GitHub Action usage

Was trying to upload a SARIF report from kube-linter with the simple action:

      - name: Upload SARIF report files to GitHub
        uses: github/codeql-action/upload-sarif@v3

Initial error

Snippet from the error output:

Run github/codeql-action/upload-sarif@v3
RequestError [HttpError]: Resource not accessible by integration
    at /home/runner/work/_actions/github/codeql-action/v3/node_modules/@octokit/request/dist-node/index.js:86:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async requestWithGraphqlErrorHandling (/home/runner/work/_actions/github/codeql-action/v3/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)
  }
}
Error: Resource not accessible by integration

The fix

Quite a simple on this time to fix, the issue was that the default permissions granted to the GITHUB_TOKEN that runs the workflow had only read repository permissions, in this I am wanting to write to the repository.

To fix and resolve:

  • Go to the effected GitHub repository to where the error is happening
  • Select Settings -> Actions -> General
  • Change to read and write permissions

A super quick blog post – hopefully it will assist you!

1 thought on “GitHub Action error Resource not accessible by integration when attempting to upload SARIF report files to GitHub”

Leave a Reply

Discover more from Thomas Thornton Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Thomas Thornton Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading