Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly merging when PR is probably ready: mergeable_state: undefined #65

Closed
hongaar opened this issue Mar 26, 2020 · 3 comments
Closed

Comments

@hongaar
Copy link
Contributor

hongaar commented Mar 26, 2020

The action merged some pull requests while checks where still failing and/or required reviews were missing. This is an example output:

INFO  Event name: status
INFO  Skipping PR update, required label missing: please-rebase
INFO  Merging PR #142 feat: validate content type
INFO  PR is probably ready: mergeable_state: undefined
INFO  PR successfully merged!
INFO  Removed labels: [ { id: 1936467964,
    node_id: 'MDU6TGFiZWwxOTM2NDY3OTY0',
    url:
     'https://api.github.com/repos/exivity/proximity/labels/automerge',
    name: 'automerge',
    color: 'ededed',
    default: false,
    description: null } ]

These are the checks for last commit on the merged branch (in this example, there was also a required review missing):

image

And here is the full workflow:

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@v0.8.0
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_PAT }}"
          MERGE_LABELS: "automerge"
          MERGE_REMOVE_LABELS: "automerge"
          MERGE_METHOD: "squash"
          MERGE_COMMIT_MESSAGE: "pull-request-description"
          MERGE_FORKS: "false"
          UPDATE_LABELS: "please-rebase"
          UPDATE_METHOD: "rebase"
@hongaar hongaar changed the title Incorrectly merging when PR is probably ready: mergeable_state: undefined Incorrectly merging when PR is probably ready: mergeable_state: undefined Mar 26, 2020
@pascalgn
Copy link
Owner

This looks like a duplicate of #61. Could you check if the information in that issue might help you?

Generally speaking, I only see two possibilities for this behaviour:

  1. This action just calls the GitHub API to merge, so it could be a problem in the API itself, causing PRs to be merged even though they should not. I find this highly unlikely, but if you suspect that this might be the cause, you need to contact GitHub support directly
  2. A wrong configuration. See Auto-Merged PR even though PR was not reviewed and checks did not pass #61. Possibly, the user from the "GITHUB_PAT" token is an administrator and is excluded from certain rules

@hongaar
Copy link
Contributor Author

hongaar commented Mar 31, 2020

@pascalgn thanks for your response. Decreasing the access level for the user who issued the PAT (our bot user) seems to have solved the issue, so your second point was indeed the reason we were seeing this.

To help others with this, would you accept a PR describing this behaviour in the Limitations section of the readme?

@hongaar hongaar closed this as completed Mar 31, 2020
@pascalgn
Copy link
Owner

pascalgn commented Apr 1, 2020

Yes, that should be fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants