pascalgn / automerge-action

GitHub action to automatically merge pull requests that are ready
MIT License
817 stars 203 forks source link

Failed to merge PR: Resource not accessible by integration #171

Open lukejgaskell opened 2 years ago

lukejgaskell commented 2 years ago

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

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/automerge-action@v0.14.2
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
Anne-Gaelle-S commented 2 years ago

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/automerge-action@v0.8.3"
        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 ?

LinhaiShen commented 2 years ago

Works for me: Change the trigger event from pull_request to pull_request_target

totoprayogo1916 commented 1 year ago

Have same problem, Not work on forks?

mmiranda commented 1 year ago

I had the same issue, it fixes when you use a PAT with permissions to manage PRs

yiliang114 commented 1 year ago

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

Abelkrijgtalles commented 10 months ago

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. image

jasmeetsinghbhatia commented 3 months ago

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. image

This one particularly did not work for me as I already had the said settings enabled. Still facing the issue.