Integrating GitLab CI with Mergify

How to automate your GitLab CI workflow using Mergify

GitLab CI/CD offers a seamless integration and delivery system, allowing developers to automate several tasks of the development process. Mergify can interact with GitLab CI when the latter reports as a CI to the GitHub Checks API. This connection paves the way for strong automation processes that depend on the results of your GitLab CI jobs.

Before you can exploit the capabilities of Mergify with GitLab CI, you should ensure:

  1. GitLab CI is correctly set up, and it’s running your project’s pipelines. Refer to the GitLab CI/CD Documentation for assistance with its setup.

  2. GitLab CI is configured to report pipeline statuses to GitHub.

  3. You have the Mergify GitHub App integrated into your repository.

Utilizing GitLab CI Status Checks with Mergify

Section titled Utilizing GitLab CI Status Checks with Mergify

Once GitLab CI forwards status checks to GitHub, they can be employed as conditions within your Mergify rules.

An illustrative example would be:

- name: Auto-merge when GitLab CI build is successful
- check-success=gitlab/ci-pipeline # Adjust this to match your GitLab CI check name
- "#approved-reviews-by>=1"
method: merge

In the given scenario, Mergify will merge pull requests automatically if they possess at least one approved review and the GitLab CI build is successful.

The potential of merging GitLab CI with Mergify is vast. As an example, Mergify could be tailored to:

We encourage you to explore Mergify’s conditions and actions to create your personalized workflow.