Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource not accessible by integration #34

Open
benknight135 opened this issue Sep 2, 2022 · 3 comments
Open

Resource not accessible by integration #34

benknight135 opened this issue Sep 2, 2022 · 3 comments

Comments

@benknight135
Copy link

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>'
@dshunfen
Copy link

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

@Fabio-Vicente
Copy link

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
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants