Taking the Wheel: Controlling Urgent Merges with Mergify Merge Queue
When using a merge queue, it can be difficult to ensure that urgent pull requests are merged quickly. This is especially true for teams that have a large number of pull requests or that are working on critical projects.
It can be very frustrating to wait for all the pull requests that are already in the queue to be merged.
Indeed, merging a 'Feature' Pull Request while a bug fix is pending does not make sense, as it could create even more bugs and code regressions, leading you to reverts; therefore, fixes must be merged first, then features.
Fortunately, Mergify Merge Queue's multiple queues & priority rules features provide a powerful help to maintain control over the merging process. They allow you to create different queues with unique configurations, enabling urgent tasks to be prioritized and merged quickly.
Let's see how they work.
Just Imagine
In order to explore how priority rules work, let's take a practical case:
- you have a merge queue setup on your repository,
- you have, let's say, 50 pull requests in your queue. Each one will have to wait for a CI that takes 1 minute to run to successfully finish before merging,
- now you have a bug fix pull request that needs to be merged as quickly as possible and you don't want to wait 50 minutes at least before it's merged.
Priority Rules 🚦
Priority rules in Mergify are a set of guidelines that determine the order of pull requests within a merge queue.
They apply a priority to a pull request based on the conditions you've defined. When a pull request is added to a queue, each priority rule is evaluated against its conditions. This assessment determines where the pull request will be placed in the queue.
If multiple rules match the pull request, the one with the highest priority value is chosen. On the other hand, if no priority rule matches it will set a medium priority value.
You could setup up priority rules like this, for instance.
queue_rules:
- name: default
queue_conditions:
- check-success=my_one_minute_CI
priority_rules:
- name: high priority
conditions:
- label=urgent
priority: high
With this configuration, you had the urgent label to your bug fix pull request and it will enter the queue in the first position, above all the 50 other pull requests with a medium priority level. Mergify will stop evaluating the current pull request and will take care of your bug fix pull request. Congrats again! Your bug fix is merged in 1 minute (or 2) instead of at least 50 minutes without leaving your usual workflow!
If you want to know more about priority rules, I invite you to take a look at our documentation.
Watch the use case video
Keep control with Mergify
In conclusion, Mergify Merge Queue's priority rules provide powerful tools to maintain control over the merging process.
Priority rules further streamline the process by automatically ordering pull requests within the queue based on predefined conditions.
With Mergify Merge Queue, teams can efficiently manage pull requests, ensuring smoother workflows and faster merging times for critical updates.
Less than 10 minutes setup.