Mergifyio / Mergifyio/mergify

Match if author has admin or write permission on the repository

Open
#451 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
No language data
Stars
339
Forks
93
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how pull_request_rules conditions are parsed and how GitHub pull request author permissions are obtained. Define the behavior of an author_has_write condition for authors with write or admin permission, then verify it works alongside the shown review and status conditions.

Written by the indexing model from the issue text.

Assessment

Tech stack
github
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.