`automerge` merges pull request, even the checks are not passed (`PR is probably ready: mergeable_state: unstable`)
Description
automerge merges sometime the pull requests, even if the checks not are completed.
From README.md
When using a personal access token (PAT) to work around the above limitation, note that when the user issuing the PAT is an administrator and branch restrictions do not include administrators, pull requests may be merged even if they are not mergeable for non-administrators (see #65). As you can see in the settings screenshot, I enabled "Include administrators" 🤔
It merges the pull request, if the required check (label-pr) is completed.

Logs
Run pascalgn/[email protected]
2021-07-01T14:41:33.965Z INFO Event name: pull_request
2021-07-01T14:41:34.677Z INFO Updating PR #414 ci(flutter): integration test only on `main`
2021-07-01T14:41:34.677Z INFO No update done due to PR mergeable_state blocked
2021-07-01T14:41:34.678Z INFO Merging PR #414 ci(flutter): integration test only on `main`
2021-07-01T14:41:34.678Z INFO Current PR status: mergeable_state: blocked
2021-07-01T14:41:34.678Z INFO Retrying after 5000 ms ... (1/6)
2021-07-01T14:41:40.016Z INFO PR is probably ready: mergeable_state: unstable
2021-07-01T14:41:41.586Z INFO PR successfully merged!
automerge file
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
if: |
contains(github.event.pull_request.labels.*.name, 'auto-merge') &&
github.event.pull_request.draft == false
steps:
- name: automerge
uses: "pascalgn/[email protected]"
env:
# We need to use a personal access token (it's the Nils access token),
# because the GitHub Actions are not able to merge a PR, when protect
# our branch (Restrict who can push to matching branches).
GITHUB_TOKEN: "${{ secrets.AUTOMERGE_TOKEN }}"
MERGE_LABELS: "auto-merge"
UPDATE_LABELS: "auto-merge"
MERGE_COMMIT_MESSAGE: "pull-request-title-and-description"
MERGE_METHOD: "squash"
Protected Branch Settings

From the README:
When the pull request is ready, it will automatically be merged. The action will only wait for status checks that are marked as required in the branch protection rules
Does this help already? 😅
I've the same problem. automerge action rebase PRs even if some mandatory checks fail
My config:
name: Automerge
on:
check_suite:
types:
- completed
status: {}
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
MERGE_LABELS: "autoapproved, dependencies, !in progress"
MERGE_METHOD: "merge"
MERGE_RETRIES: "6"
MERGE_REQUIRED_APPROVALS: "1"
UPDATE_LABELS: "automerged"
UPDATE_METHOD: "rebase"
Branch rules

Checks
Somehow those 2 screenshots don't match. If an action is marked as required in the branch protection rules, it should also be shown with a "Required" text in the status overview, like here:

I think once merged that info disappears. As you can see from this screenshot there are workflows required
OK, then maybe the issue could be that the user "hospitalrunbot" you're using to run automerge-action maybe has admin rights on the repository and thus may bypass failed required checks?
OK, then maybe the issue could be that the user "hospitalrunbot" you're using to run automerge-action maybe has admin rights on the repository and thus may bypass failed required checks?
Good point. I'll see if it's due to that
This seems to be a dupe of #65
I think this is not yet fixed, or at least it's not clear what the cause for the problem is. However, it's a long time since there was some activity in this issue, so I will close it for now. If you have any new information or need any help, feel free to reopen this issue!