mergify
mergify copied to clipboard
Match if author has admin or write permission on the repository
An attribute like author_has_write
, a Boolean representing whether the PR author has admin
or write
permission on the repository, would I think solve my use case.
Use case:
I would like PRs to be automatically merged after 1 approving review and a status check success. This works perfectly when there are other reviewers to review one's PR:
pull_request_rules:
- name: automatic merge
conditions:
- base=master
- status-success="travis"
- label!=work-in-progress
- "#approved-reviews-by>=1"
- "#review-requested=0"
- "#changes-requested-reviews-by=0"
- "#commented-reviews-by=0"
actions:
merge:
method: merge
strict: smart
delete_head_branch: {}
I'd also like to use this on projects where I'm the sole maintainer, but unfortunately GitHub doesn't let one review one's own PR. So I've added another rule that exempts PRs by me from requiring a review that GitHub won't allow me to give:
pull_request_rules:
- name: automatic merge
conditions:
- base=master
- status-success="travis"
- label!=work-in-progress
- author=alecmocatta
- "#review-requested=0"
- "#changes-requested-reviews-by=0"
- "#commented-reviews-by=0"
actions:
merge:
method: merge
strict: smart
delete_head_branch: {}
This works, but I think ideally I'd like to replace author=alecmocatta
with a new author_has_write
attribute. Let me know if there's another solution I'm missing!
That sounds like a nice idea.