Skip to content

Commit

Permalink
Add Mergify configuration for Dependabot
Browse files Browse the repository at this point in the history
Add a mergify.yaml configuration file which automates the review and
merging of pull requests generated by Dependabot.
  • Loading branch information
jonathanio committed Mar 30, 2024
1 parent f0f9d6f commit 65ab95e
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
# When working with Dependabot and GitHub Actions, where those Actions can make
# changes to documentation or code based on updates to the repository's
# dependencies, it is always necessary for the pull requests to go though
# multiple stagings using the force-integrations-run label. These rules take
# this into account and allow those stages to be managed and triggered as
# necessary.

pull_request_rules:
# If the pull request was raised by Dependabot, and only Dependabot or GitHub
# Actions have make changes to the branch, then automatically approve if it's
# not in conflict with the base branch, and not closed.
- name: Automatic approval for Dependabot pull requests
conditions:
- 'author=dependabot[bot]'
- 'base=main'
- '#commits-behind=0'
- '-conflict'
- '-closed'
- or:
- 'commits[*].author==dependabot[bot]'
- 'commits[*].author==github-actions[bot]'
actions:
review:
type: APPROVE

# If a commit other than the initial commit is added to a pull request raised
# by Dependabot, and that commit author is GitHub Actions, and the last
# synchronised commit title starts with the word Syncing, then add the
# force-integrations-run label to trigger the GitHub Workflows for this
# commit
- name: Trigger force-integrations-run on GitHub Actions commits
conditions:
- 'author=dependabot[bot]'
- 'base=main'
- '#commits>1'
- 'commits[-1].author=github-actions[bot]'
- 'commits[-1].commit_message~=^Syncing'
- '#commits-behind=0'
- '-label=force-integrations-run'
- '-conflict'
- '-closed'
- not:
or:
- check-neutral~=^Remove Label
- check-pending~=^Remove Label
- check-success~=^Remove Label
actions:
label:
add:
- 'force-integrations-run'

# If the pull request was raised by Dependabot, it only has a linear history,
# it has been approved for merging into the main or master branches, and is
# neither in conflict with the main branch, fallen behind, nor the
# force-integrations-run label is still present, then automatically merge
# this request.
- name: Automatic merge for Dependabot pull requests
conditions:
- 'author=dependabot[bot]'
- 'base=main'
- 'linear-history'
- '#approved-reviews-by>=1'
- '-label=force-integrations-run'
- '-conflict'
- '-closed'
actions:
merge:
method:

0 comments on commit 65ab95e

Please sign in to comment.