Skip to content

Resource not accessible by integration #34

Open
@benknight135

Description

@benknight135

Received Resource not accessible by integration error when running in workflow.

/usr/local/bundle/gems/octokit-4.14.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/i3drobotics/phase-dev/merges: 403 - Resource not accessible by integration // See: https://docs.github.com/rest/reference/repos#merge-a-branch (Octokit::Forbidden)
	from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/response.rb:9:in `block in call'
	from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/response.rb:61:in `on_complete'
	from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/response.rb:8:in `call'
	from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
	from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:61:in `call'
	from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/request/retry.rb:[13](https://github.com/i3drobotics/phase-dev/runs/8153921118?check_suite_focus=true#step:15:14)0:in `call'
	from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/rack_builder.rb:[14](https://github.com/i3drobotics/phase-dev/runs/8153921118?check_suite_focus=true#step:15:15)3:in `build_response'
	from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/connection.rb:387:in `run_request'
	from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/connection.rb:175:in `post'
	from /usr/local/bundle/gems/sawyer-0.8.2/lib/sawyer/agent.rb:94:in `call'
	from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/connection.rb:[15](https://github.com/i3drobotics/phase-dev/runs/8153921118?check_suite_focus=true#step:15:16)6:in `request'
	from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/connection.rb:28:in `post'
	from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/client/commits.rb:[21](https://github.com/i3drobotics/phase-dev/runs/8153921118?check_suite_focus=true#step:15:22)4:in `merge'
	from /action/lib/index.rb:31:in `<main>'

Activity

dshunfen

dshunfen commented on Oct 28, 2022

@dshunfen

I'm also seeing the same issue. I've tried a changing a few permissions on the job to no avail.

Fabio-Vicente

Fabio-Vicente commented on Feb 2, 2023

@Fabio-Vicente

I've passed through this issue too and I've made a huge search by a solution.

This log is not even a bit intuitive. But, by the status code response (403), I've guessed that it could be something related to authorization. And it is!

Taking a look on the source code, I've found that it ocurrors when we make a action that our GITHUB_TOKEN is not supposed to do.

Solution:
Include this lines on your workflow:

permissions:
      contents: write

It can be at the job scope or at workflow at all.

This behavior can be setted to the whole repositry too. Go to:
Settings -> Actions -> General -> Workflow permissions -> Read and write permissions


Captura de tela de 2023-02-02 01-03-25

source: https://docs.github.com/en/actions/security-guides/automatic-token-authentication

PS: github.token is a context copy of GITHUB_TOKEN. So, if you don't understand from where cames this variable, that is the answer.

daniel-shuy

daniel-shuy commented on Dec 3, 2024

@daniel-shuy

Created #41 to document this in the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dshunfen@daniel-shuy@benknight135@Fabio-Vicente

        Issue actions

          Resource not accessible by integration · Issue #34 · devmasx/merge-branch