We have a GitHub action (https://github.com/pascalgn/automerge-action) which automatically merges PRs when they're ready. This was all working fine, but for about 2 days we are now getting "Resource not accessible by integration" when the action is trying to merge the PR.
The error occurs when calling https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
Solved! Solved! Go to Solution.
It looks to be working again. Without any changes on our side, the action now runs successfully again. I am guessing there were some hiccups in the actions permission handling, as it's still in beta.
We had a look again and it very much looks like GitHub is actively blocking the action from executing the merge when the PR contains changes of the main.workflow file. We tested this by creating a PR which changes the main.workflow file and we got the "Resource not accessible by integration" error again. When changing the PR so that the workflow file is no longer changed, it gets merged without any problems.
(By the way, this same also happens when using the git CLI from within an action. A git push when using the action token for authentication is rejected when it contains changes of the main.workflow file, git push will exit with code 1)
We could not find any hints about this in the documentation, maybe someone from GitHub support can confirm these findings?
Not sure why they did not reply in this thread, but I did get a confirmation from GitHub support via mail:
OAuth tokens and GitHub Apps are restricted from editing the main.workflow file. This means it isn't possible to merge a Pull Request via an Action if it updates the main.workflow file I'm afraid.
This is expected behaviour currently but we'll pass your feedback onto the team to consider.