Integrating CircleCI with Mergify
How to automate your CircleCI workflow using Mergify
CircleCI is a modern CI/CD platform that allows you to build, deploy, and automate your projects. Mergify can interact with CircleCI by evaluating the status checks reported by CircleCI to GitHub. This enables powerful automation workflows that react to the results of your CircleCI jobs.
Prerequisites
Section titled PrerequisitesBefore you can use Mergify with CircleCI, ensure the following:
-
CircleCI is properly set up and is building your projects. See the CircleCI Documentation for help with setting up CircleCI.
-
CircleCI is configured to report build statuses to GitHub. This is typically done by installing CircleCI’s GitHub App.
-
The Mergify GitHub App is installed in your repository.
Using CircleCI Status Checks in Mergify Configuration
Section titled Using CircleCI Status Checks in Mergify ConfigurationOnce CircleCI reports status checks to GitHub, they can be used as conditions in your Mergify rules. Here’s a simple example:
pull_request_rules:
- name: Automatically merge when CircleCI build succeeds
conditions:
- "check-success = ci/circleci: test" # Change this to match your CircleCI 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 CircleCI build.
Further Configuration
Section titled Further ConfigurationThe possibilities of integrating CircleCI with Mergify are extensive. For instance, you could use Mergify to:
-
Automatically update a PR when a build fails;
-
Apply labels, request reviewers, or post comments based on the results of status checks.
We encourage you to explore Mergify’s conditions and actions to create your personalized workflow.