automerge-action
automerge-action copied to clipboard
Failed to merge PR: Resource not accessible by integration
Description
Running into an issue where the action intermittently is unable to merge the pull request. It complains about the resource not being accessible from the integration (Failed to merge PR: Resource not accessible by integration
).
Setup
- Pull Requests are coming from forks, but that shouldn't matter as we are using the
pull_request_target
event. - We run an auto approve step and then an auto merge. The auto merge ends up failing all retries and returns the following.
Has anyone seen this issue? Is there a certain way a pull request could be created from a fork that might cause this?
Logs
Run pascalgn/[email protected]
2021-09-07T17:49:30.087Z INFO Event name: pull_request_target
2021-09-07T17:49:30.415Z INFO Skipping PR update, required label missing: automerge
2021-09-07T17:49:30.416Z INFO Merging PR #<PR NUMBER>
2021-09-07T17:49:30.416Z INFO PR is probably ready: mergeable_state: unstable
2021-09-07T17:49:30.650Z INFO Failed to merge PR: Resource not accessible by integration
2021-09-07T17:49:30.650Z INFO Retrying after 5000 ms ... (1/6)
2021-09-07T17:49:36.150Z INFO Failed to merge PR: Resource not accessible by integration
2021-09-07T17:49:36.150Z INFO Retrying after 5000 ms ... (2/6)
2021-09-07T17:49:41.846Z INFO Failed to merge PR: Resource not accessible by integration
2021-09-07T17:49:41.846Z INFO Retrying after 5000 ms ... (3/6)
2021-09-07T17:49:47.330Z INFO Failed to merge PR: Resource not accessible by integration
2021-09-07T17:49:47.330Z INFO Retrying after 5000 ms ... (4/6)
2021-09-07T17:49:52.824Z INFO Failed to merge PR: Resource not accessible by integration
2021-09-07T17:49:52.824Z INFO Retrying after 5000 ms ... (5/6)
2021-09-07T17:49:58.336Z INFO Failed to merge PR: Resource not accessible by integration
2021-09-07T17:49:58.336Z INFO Retrying after 5000 ms ... (6/6)
2021-09-07T17:50:04.029Z INFO Failed to merge PR: Resource not accessible by integration
2021-09-07T17:50:04.029Z INFO PR could not be merged after 6 tries
I'm facing the same issue. Here is my yaml file :
name: automerge check
on:
pull_request:
types:
- labeled
check_suite:
types:
- completed
permissions:
contents: read
pull-requests: write
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ github.token }}"
MERGE_LABELS: ":rocket: Ready to Merge"
MERGE_COMMIT_MESSAGE: "pull-request-title"
UPDATE_LABELS: ":rocket: Ready to Merge"
UPDATE_METHOD: "rebase"
MERGE_FORKS: "false"
It was working fine before I added the permissions
part.
Anyone has an idea ?
Works for me: Change the trigger event from pull_request to pull_request_target
Have same problem, Not work on forks?
I had the same issue, it fixes when you use a PAT with permissions to manage PRs
I met this problem and finally found that the GITHUB_TOKEN
token does not exist. You can check whether the secrets.GITHUB_TOKEN
exists or whether there is an error. @mmiranda @totoprayogo1916
I found the solution: Go to the settings of your repo, actions, general. Then change the permission to read and write, and allow it to open and approve pull requests.