fork-sync: Won't automerge the PR. HttpError: Unprocessable Entity: "Can not approve your own pull request"

Hi! First thanks for your job. I’m facing a strange issue here that I cannot get rid of. I finally achieved to get the workflow running as it is creating a PR to Sync the repo. However, PR won’t be automerged and the GitHub Actions will fail. I tried two different configs, with different errors:

Config 1:

jobs:
  sync:
    runs-on: ubuntu-latest

    steps:
      - uses: tgymnich/fork-sync@v1.4
        with:
          owner: mikecao
          token: ${{ secrets.GH_PERSONAL_TOKEN }} # with public repo access
          head: master
          base: production
          merge_method: merge
          pr_title: Fork Sync
          auto_approve: true

Error 1:

Run tgymnich/fork-sync@v1.4
  with:
    owner: mikecao
    token: ***
    head: master
    base: production
    merge_method: merge
    pr_title: Fork Sync
    auto_approve: true
request failed after 4 retries with a delay of 60
Error: Failed to create or merge pull request: HttpError: Unprocessable Entity: "Can not approve your own pull request"

Config 2:

jobs:
  sync:
    runs-on: ubuntu-latest

    steps:
      - uses: tgymnich/fork-sync@v1.4
        with:
          owner: mikecao
          token: ${{ secrets.GITHUB_TOKEN }} # not my personal token
          head: master
          base: production
          merge_method: merge
          pr_title: Fork Sync

Error 2:

Run tgymnich/fork-sync@v1.4
  with:
    owner: mikecao
    token: ***
    head: master
    base: production
    merge_method: merge
    pr_title: Fork Sync
    auto_approve: false
request failed after 4 retries with a delay of 60
Error: Failed to create or merge pull request: HttpError: Unprocessable Entity: "Can not approve your own pull request"

Do you know what could be the problem? If it is about a misconfiguration from my side, I will be happy to open a PR updating the documentation when I realize of my error.

Owner repo: https://github.com/mikecao/umami My repo: https://github.com/tairosonloa/umami (you can see there some manually closed PR that the GitHub Action created while I was testing)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 22 (7 by maintainers)

Commits related to this issue

Most upvoted comments

The following config is working, as you suggested:

jobs:
  sync:
    runs-on: ubuntu-latest

    steps:
      - uses: tgymnich/fork-sync@v1.3
        with:
          owner: mikecao
          github_token: ${{ secrets.GITHUB_TOKEN }}
          personal_token: ${{ secrets.GH_PERSONAL_TOKEN }}
          head: master
          base: production
          merge_method: merge
          pr_title: Fork Sync
          auto_approve: true

Thanks for the hint, I got into this especially as the README.md still show’s v1.4 maybe this should be updated to a placeholder to look into releases what I missed - sorry!

I’m still having this issue on v1.4 with this config: https://github.com/SebTM/YubiKey-Guide/blob/sync/.github/workflows/sync.yml Did I missed something? TOKEN has permissions for public_repo

Hi @tairosonloa, how are you? Just wondering if you have any updates on this case?

Still using 1.3, yep. Same config that https://github.com/tgymnich/fork-sync/issues/46#issuecomment-820223956

According to the discussion here https://github.community/t/do-not-require-owner-approval-if-the-pull-request-is-from-an-owner/369/66 it seems that reviewing/approving your own PR is currently not possible even if you’re a code owner or admin.

I can remember that for repo admins there is a possibility to merge a PR even if required checks (like builds, reviews, …) haven’t been passed, yet. It’s inside of the dropdown of the merge button. If there was an api for that we might could bypass all merge checks for the github action user. Unfortunately i didn’t find anything in the docs https://docs.github.com/en/rest/reference/pulls#merge-a-pull-request so not sure if that’s possible 😢

Yes v1.3 is still recommended for automerge when an approval is required. I still need to find the time to find out if there is an API to approve/merge your own PR when an approval is required. If there is no way I might even undo the changes up to v1.5