pytest-coverage-comment: Resource not accessible by integration
Hi,
I’m trying to use this GH Action in https://github.com/openai/gym/pull/2789. On my fork it seems to works fine: https://github.com/kir0ul/gym/runs/6244334853?check_suite_focus=true, but on the main repo I get Error: HttpError: Resource not accessible by integration: https://github.com/openai/gym/runs/6244334980?check_suite_focus=true.
I tried to modify the permissions as suggested in https://github.com/MishaKav/pytest-coverage-comment/issues/30#issuecomment-962475629, but it didn’t work.
Is there any way to work around this error?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 20 (3 by maintainers)
I encountered this same error while working on a class project for university. I was able to resolve it after reviewing the github organization and repository documentation for configuring the default
GITHUB_TOKENpermissions.Organization documentation link :https://docs.github.com/en/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#setting-the-permissions-of-the-github_token-for-your-organization
Repository documentation link: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions
Essentially, you need to change the workflow read/write permissions from the defaults on the repository or organization level. I believe that you need to be the owner of the repo/organization to make the change. I have not tried as admin, but I know that you are unable to as a member.
The default settings:
Settings that fix the error:
I have tested my actions file with below permissions setting and it works.
I’m also still seeing this error with the following configuration:
I added the
pull-requests: writepermissions at the root of my workflow file and also removed theon: push, so only thepull_requesttrigger remains, that solved it for me.Also may be solved with
workflow_runlike in this example #153Oh! I think I get it! I was having a similar problem even after adding the following code and following Ryan’s suggestion
I noticed that it passed on pushing to my feature, but failed on merging to master. So, I added
contents: writebased on this comment and it then passed on merge.So basically, I think I will set pytest-coverage-comment to not run on merge with an if condition as I think it is not required at that stage.
Hopefully this is useful for someone! 😃
I was able to fix something similar by changing it from
pushtopull_requestTry adding
pull-requests: writeto your permissions for theGITHUB_TOKEN