6

Web Tools #461 - Mergify, Frameworks, React Tools, Uncats

 1 year ago
source link: https://mailchi.mp/webtoolsweekly/web-tools-461
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Mergify, Frameworks, React Tools, Uncats

Issue #461 • May 19, 2022

The following intro is a paid product review for Mergify, a GitHub-based service for automating your pull requests and code merges.

If you're working in a team environment, large or small, it's pretty likely that pull requests and code merges are a regular part of your routine. Anything to ease or automate that process – which often includes code reviews, assignments, labeling, etc. – is certainly going to be a boost to your team's workflow.

Enter Mergify, a GitHub-based service that automates your pull requests based on rules you create, enabling you to streamline all pull request-related workflows. Mergify is used by number of big tech names including Amazon, Mozilla, Uber, Netflix, Airtable, and IBM.

Mergify

Here are some common use cases to help you determine how valuable Mergify can be to your team:

  • Automated Merges – You set up custom rules that determine if merges take place. No need for manual checks as long as certain conditions are met.
  • Safe and Prioritized Merge Queues – Your custom rules can determine how important a pull request is, allowing your merges to take place safely and in predetermined priority.
  • Automatic Branch Updates – You can keep all branches up to date automatically, avoiding any use of the "update branch" button when pull requests are outdated compared to the master branch.
  • Automated Review Requests – Based on rules you define, pull requests can be automatically assigned to the appropriate team or reviewer without any manual action necessary.
Those are just a few of the powerful ways that Mergify can help you and your team, but let's delve a little more into those specific features.

First of all, as I briefly covered in the overview above, Mergify's true power comes in the specific rules you create that form the backbone of all your automations.

Once you've installed Mergify through GitHub, Mergify can be configured by adding a YAML file to your project's root folder. The default config file, accessible in your Mergify dashboard is shown in the screenshot below.
Mergify's default config
Mergify's default configuration file
The meat of the config file is divided into two main sections: Conditions and Actions, both of which are expanded on in the Mergify documentation. Conditions are similar to any conditional-type logic in programming. Here is an example:
conditions:
  - or:
    - author=alejandro
    - author=guerrero

The above rule uses the "or" operator to determine that if either of the listed names is the author of the pull request, the condition will pass. If this is the only condition, then an action will be triggered.

Here's another example of condition:

conditions:
  - or:
    - and:
      - author=bichette
      - label=core
    - and:
      - author=romano
      - label=frontend

This rule uses both "or" and "and' along with the "author" and "label" attributes. In this case, the merge will take place if the author of the pull request is "bichette" with a "core" label attached, or if the author is "romano" with a "frontend" label attached. Mergify's docs list all the attributes available, giving you a good sense of how many possibilities there are.

Actions are triggered once your defined conditions are met. Here's an example that includes an assignment-related action:

pull_request_rules:
  - name: assign PRs with modified JS files to manoah
    conditions:
      - files~=\.js$
      - -closed
    actions:
      assign:
        add_users:
          - manoah

The above rule will assign a specific reviewer to a pull request if that pull request involves modified JavaScript files.

Here's another practical example where a specific condition determines that two entire teams should review a pull request:

pull_request_rules:
  - name: ask security team to review security labelled PR
    conditions:
      - label=security
    actions:
      request_reviews:
        teams:
          - "@myorg/security-dev"
          - "@myorg/security-ops"

Other actions you can trigger in response to conditions include automatically adding labels, copying a pull request to another branch, backporting, post-check conditions, and lots more.

One final thing I'll discuss is how Mergify's features far exceed that of the competition. For example, Mergify allows the following, among other features:

  • Unlimited rules
  • Automated actions (some of which I demonstrated above)
  • Handling of pull request dependencies
  • Ability to assign reviews randomly to teams or members
  • Test and merge multiple enqueued pull requests in parallel
  • Use a bot account to act in your behalf
  • Private Mergify deployment
  • Premium support from the Mergify team
  • And lots more...
All these features make Mergify the fastest and most feature-rich merge queue on the market and many corporate teams working on large projects have had lots of positive things to say about Mergify (check out the home page for some testimonials).

I should also point out that Mergify's code is open source, so you can contribute or even make feature requests or improvements by opening an issue.

Mergify is free for open source projects and there are multiple commercial plans available, depending on your team's size and needs. So check out Mergify today if you want to be able to customize and prioritize your team's code merges safely, securely, and as fast as possible.

Now on to this week's tools!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK