Workflow + Action Bot: "An error occurred while performing auto-merge"

I’m getting an error on a pull request: An error occurred while performing auto-merge

Here’s the situation:

  1. I have a github app (called microCOVID) that serves as a bot this whole workflow (including commits)
  2. I have a workflow that runs this bash script whic updates some files and commits them, and submits a PR
  3. I updated the branch protection rules to include the microCOVID bot/app:
  4. Everything is working up to the auto-merge part. The worfklow edits the files, the bot commits the changes, the bot submits the pull request, it is set to auto-merge. Then I get the error. Example of a “stuck” PR here. Screenshot below.

Some notes:

  • I am intentionally generating an INSTALLATION_ACCESS_TOKEN instead of using GITHUB_TOKEN so that the checks on the PR will actually run.
  • I have given the app/bot pretty extensive permissions anywhere where it might seem relevant. I haven’t tried giving it ALL permissions yet. I kind of doubt it has to do with permissions, because I think the PR and auto-merge commands just wouldn’t be allowed if it was a permissions issue.
  • I had this whole thing working properly when I used a PERSONAL_ACCESS_TOKEN instead of an INSTALLATION_ACCESS_TOKEN. The auto-merge worked then.
  • The workflow cron job ran this morning and I got a similar, but different error. It says “Attempting to auto-merge…” and has been hung there for 2 hours.

I couldn’t find any results for this error message on google, which was surprising. Any ideas about how to proceed?

I’m definitely curious about the answer.

Fwiw, @dependabot itself doesn’t cooperate w/ auto-merge:

Generally, GitHub actions have some things that prevent them from eating their own tail, so a github-action triggered push won’t trigger another GitHub action. It wouldn’t shock me if you’re hitting an extension of this.

It looks like people have workarounds, e.g.:

In general, IMO, if you get an error from any piece of software, you’re entitled to file a bug report, so if I hit it, I’d go straight to:

https://support.github.com/
and file a ticket.

(And when you get a response, please share!)

1 Like

Thanks so much, @jsoref! I didn’t realize there was a different place to post bugs. I’ve posted it there. And I will definitely

Also on the “workflows not getting into a recursive loop” point: I intentionally use an INSTALLATION_ACCESS_TOKEN instead of GITHUB_TOKEN in order to allow the PR to run the checks it needs to. The checks do run, which is good! It just fails to do the final merge.

I suppose one solution (until the bug is fixed) is to follow the instructions that you linked to. I could basically do the following:

1 Like

After much testing and debugging, I came up with a fully bot-based commit-and-merge solution.

Take a look here:

1 Like

This is not a direct solution to your problem, however, you might be interested in Mergify for such things.

It’d solve your automatic merge use case elegantly with a rule such as:

pull_request_rules:
  - name: automatic merge for microCOVID
    conditions:
      # You might want to add more conditions
      # https://docs.mergify.io/conditions/
      - author=microCOVID[bot]
     actions:
        merge:
          method: merge

This has the upside of allowing much more customization by just using a single YAML file — and you can automate more stuff of course.

Disclaimer: I’m part of the Mergify team. :slight_smile: