You Don’t Work Alone, so Mergify Supports Team

You Don’t Work Alone, so Mergify Supports Team

Julien Danjou

What’s software development without a team? Not a fun thing!

A lot of our users are part of organizations, which means there are several people involved in developing software. Sometimes, organizations are large and creating teams helps to keep arrangement understandable.

Therefore, GitHub supports creating team inside an organization. Teams make it consistent to reflect your organization structure and ease permissions management.

What about Mergify?

I’m glad you ask since Mergify now supports teams as well. What does it mean? Well, you can now refer to a team in your rules, using various conditions. Let’s get an example.

Imagine you want to automatically merge any patch that has one review if it comes from your core reviewer team called @mergifyio/devs. You can match the pull request author using the author condition and use the team name to match any member:

pull_request_rules:
  - name: automatic merge with 1 approval from the dev team
    conditions:
      - author=@mergifyio/devs
      - "#approved-reviews-by>=1"
    actions:
      merge:
        method: merge
  - name: automatic merge with 2 approvals from anyone
    conditions:
      - "#approved-reviews-by>=2"
    actions:
      merge:
        method: merge

With this set of rules, any pull request approved by two developers will be merged. A pull request would also be merged if it had only one approval but would come from one the member of the @mergifyio/devs team.

Supported Conditions

The conditions that support teams right now are:

  • assignee
  • approved-reviews-by
  • author
  • changes-requested-reviews-by
  • commented-reviews-by
  • dismissed-reviews-by
  • review-requested

You can imagine using teams in a variety of scenarios, like trusting only reviews from certain teams based on the files that are modified by the pull request, etc. Be creative!