mergeable
mergeable copied to clipboard
Is that possible to limit auto merge to issues with certain labels?
I'm trying to setup mergeable to merge pr when CI passed and labeled "lgtm" , I tried this https://github.com/LeoQuote/test-repo/blob/master/.github/mergeable.yml but not working as I expected. The pr https://github.com/LeoQuote/test-repo/pull/2 was merged right after CI passed, totally ignored the validate I configured.
Expected: auto merge only merge pr labeled lgtm
Actual: auto merge merges every pr.
mergeable config:
version: 2
mergeable:
- when: pull_request.*, pull_request_review.*, status.*, check_suite.*
name: "Automatically merge pull requests once it passes all checks"
validate:
- do: label
must_include:
regex: 'lgtm|approved|goodtogo'
message: 'We need lgtm tag to auto merge'
pass:
- do: merge
merge_method: "squash"
I know this can be done by setting another rule enforcing lgtm label and set mergeable check as a must. But I want it this way as it does not require every single pr labeled lgtm
@LeoQuote Hey, thanks for bringing this to our attention. We will look into this.
The merge action currently as it is implemented does rely on the mergeable checks being required for the validators to be enforced.
@shine2lay From a quick glance, I believe the scope of work is:
- Amending
EventAware.getPayloadto support the events'status' and 'check_suite' such that the correct PR is returned. This code is already in theMerge` action. - Refactor the
Mergeaction to useEventAware.getPayloadinstead. - Update supportedEvents in the validators to include
status.successandcheck_suite
Thoughts?
Related to #431
I second this feature request. Our config checks if an auto merge label exists and we have mergeable set as a required check. Our issue is that the labels validator won't run on check_suite and status events as you mentioned nor will it run on label created events. Therefore, our team finds the auto merge functionality buggy because we only trigger auto merge if we get a pull_request.edited or pull_request_review.submitted event!!
@jaisal1024 thanks for the feedback, I agree that current feature is not ideal. I am very busy to take on this task for now, If you want to create a PR for this feature, I'll make sure to get that reviewed and merged in ASAP. If not I'll try to pick this up when I have some free time.
Hey id love to give it a shot, just need some bandwidth from my team lead