Skip to content

Commit

Permalink
github: Automate some labels with mergify
Browse files Browse the repository at this point in the history
This introduces some mergify configuration to automate setting labels
on PRs. This does NOT turn on PR merge automation.

- `CI/CD` for CI config changes
- `documentation` for markdown file changes
- `testing` for test code
- `ci-failure` for PRs that failed CI
- `needs-rebase` for PRs in conflict

Signed-off-by: Russell Bryant <[email protected]>
  • Loading branch information
russellb committed Jun 25, 2024
1 parent 78d54f5 commit 032fada
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
pull_request_rules:

- name: label-cicd
description: Automatically apply CI/CD label
conditions:
- or:
- files=.github/mergify.yml
- files=.github/workflows/**/*
- files=.pylintrc
- files=.spellcheck-en-custom.txt
- files=.spellcheck.yml
- files=tox.ini
- files=.markdownlint-cli2.yaml
actions:
label:
add:
- CI/CD

- name: label-documentation
description: Automatically apply documentation label
conditions:
- or:
- files~=.*\.md
- files~=docs/.*
actions:
label:
add:
- documentation

- name: label-testing
description: Automatically apply testing label
conditions:
- or:
- files~=tests/.*
- files=tox.ini
actions:
label:
add:
- testing

- name: ping author on conflicts and add 'needs-rebase' label
conditions:
- conflict
- -closed
actions:
label:
add:
- needs-rebase
comment:
message: |
This pull request has merge conflicts that must be resolved before it can be
merged. @{{author}} please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork
- name: remove 'needs-rebase' label when conflict is resolved
conditions:
- -conflict
- -closed
actions:
label:
remove:
- needs-rebase

- name: Apply ci-failure label if any CI checks have failed
conditions:
- "#check-failure>0"
actions:
label:
add:
- ci-failure

- name: Remove ci-failure label if no failures are present
conditions:
- "#check-failure=0"
actions:
label:
remove:
- ci-failure

0 comments on commit 032fada

Please sign in to comment.