---
title: Integrating GitLab CI with Mergify
description: How to automate your GitLab CI workflow using Mergify
---

import gitlabLogo from "../../images/integrations/gitlab/logo.svg"
import IntegrationLogo from "../../../components/IntegrationLogo.astro"

<IntegrationLogo src={gitlabLogo} alt="GitLab logo"/>

[GitLab
CI/CD](https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/)
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.

:::caution
  While Mergify supports GitLab as a CI reporting job status to GitHub, Mergify
  does not support GitLab as a development platform (merge requests, etc).
:::

## Prerequisites

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](https://docs.gitlab.com/ee/ci/)
   for assistance with its setup.

2. GitLab CI is [configured to report pipeline statuses to
   GitHub](https://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/github_integration.html).

3. You have the [Mergify GitHub App](/integrations/github) installed into your
   repository.

## 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:

```yaml
pull_request_rules:
  - name: Auto-merge when GitLab CI build is successful
    conditions:
      - check-success = gitlab/ci-pipeline  # Adjust this to match your GitLab CI check name
      - "#approved-reviews-by >= 1"
    actions:
      merge:
        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.

## Additional Configuration

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

import CIFurther from './_ci-further.mdx'

<CIFurther />
