automerge-action: Does not automerge when "branch is out-of-date with the base branch"

In a private repo, using default config from the README, with added MERGE_REMOVE_LABELS:

name: automerge
on:
  pull_request:
    types:
      - labeled
      - unlabeled
      - synchronize
      - opened
      - edited
      - ready_for_review
      - reopened
      - unlocked
  pull_request_review:
    types:
      - submitted
  check_suite:
    types:
      - completed
  status: {}
jobs:
  automerge:
    runs-on: ubuntu-latest
    steps:
      - name: automerge
        uses: "pascalgn/automerge-action@135f0bdb927d9807b5446f7ca9ecc2c51de03c4a"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_REMOVE_LABELS: "automerge"

We have branch protection rules like this:

image

The PR to add this action was approved by two people (1 approval is required). The master branch had since moved forward from other PRs, meaning normally I need to manually click this button, wait ~5 minutes for CI to pass, before I can manually merge:

image

Instead, I added the automerge label, and the action was triggered but failed to merge:

INFO  Event name: pull_request
INFO  Updating PR #2541 GHA: Merge PRs automatically when labelled "automerge"
INFO  No update necessary, mergeable_state: clean
INFO  Merging PR #2541 GHA: Merge PRs automatically when labelled "automerge"
INFO  PR is probably ready: mergeable_state: clean
INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.
INFO  Retrying after 10000 ms ... (1/6)
INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.
INFO  Retrying after 10000 ms ... (2/6)
INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.
INFO  Retrying after 10000 ms ... (3/6)
INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.
INFO  Retrying after 10000 ms ... (4/6)
INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.
INFO  Retrying after 10000 ms ... (5/6)
INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.
INFO  Retrying after 10000 ms ... (6/6)
INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.
INFO  PR could not be merged after 6 tries

I expected it would merge master into the PR, wait for the checks to pass, and then merge the PR into master.

The checks looks like this:

image

This looks wrong, “Travis CI - Branch” is green:

INFO  Failed to merge PR: Required status check "Travis CI - Branch" is expected.

So the PR is in a clean mergeable state, but branch protection rules require master to be merged into the PR branch, before the PR can be merged into master.

Is it possible for this action to do the update from master into the PR? Basically the same as clicking that button?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (6 by maintainers)

Most upvoted comments

This may be related to Github Actions, but there are other approaches to automating merges as well. One that I’ve used in past is https://mergequeue.com that does not use Github Action to manage automerge, so some of the limitations here can be overcome. It also support auto-rebasing.