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

import jenkinsLogo from "../../images/integrations/jenkins/Jenkins_logo.svg"
import IntegrationLogo from "../../../components/IntegrationLogo.astro"

<IntegrationLogo src={jenkinsLogo} alt="Jenkins logo"/>

[Jenkins](https://www.jenkins.io/) is a popular open-source automation server
that allows you to build, deploy, and automate your projects. Mergify can
interact with Jenkins by evaluating [the status
checks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks)
reported by Jenkins to GitHub. This enables powerful automation workflows that
react to the results of your Jenkins jobs.

## Prerequisites

Before you can use Mergify with Jenkins, ensure the following:

1. Jenkins is properly set up and is building your projects. See the [Jenkins
   Documentation](https://www.jenkins.io/doc/) for help with setting up
   Jenkins.

2. Jenkins is configured to report build statuses to GitHub. This is typically
   done via plugins such as the [GitHub
   plugin](https://plugins.jenkins.io/github/) or the [GitHub Branch Source
   Plugin](https://plugins.jenkins.io/github-branch-source/).

3. The [Mergify GitHub App](/integrations/github) is installed in your repository.

## Using Jenkins Status Checks in Mergify Configuration

Once Jenkins reports status checks to GitHub, they can be used as conditions in
your Mergify rules. Here's a simple example:

```yaml
pull_request_rules:
  - name: Automatically merge when Jenkins build succeeds
    conditions:
      - check-success = continuous-integration/jenkins/pr-merge  # Change this to match your Jenkins check name
      - "#approved-reviews-by >= 1"
    actions:
      merge:
        method: merge
```

In this example, Mergify will automatically merge pull requests that have at
least one approved review and a successful Jenkins build.

:::note
  The `check-success` check name should match the name of the Jenkins check
  reporting to GitHub.
:::

## Further Configuration

The possibilities of integrating Jenkins with Mergify are extensive.
For instance, you could use Mergify to:

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

<CIFurther />
