label๐
The label
action can add or remove labels from a pull request.
Options๐
Key Name |
Value Type |
Default |
Value Description |
---|---|---|---|
|
list of Template |
|
The list of labels to add. |
|
list of Template |
|
The list of labels to remove. |
|
Boolean |
|
Remove all labels from the pull request. |
|
list of Template |
|
Toggle labels in the list based on the conditions. If all the conditions are a success, all the labels in the list will be added, otherwise, they will all be removed. |
Examples๐
๐ฅ Warn on Conflicts๐
When browsing the list of pull request, GitHub does not give any indication on which pull requests might be in conflict. Mergify allows to do this easily by adding a label.
pull_request_rules:
- name: warn on conflicts
conditions:
- conflict
actions:
comment:
message: "@{{author}} this pull request is now in conflict ๐ฉ"
label:
add:
- conflict
- name: remove conflict label if not needed
conditions:
- -conflict
actions:
label:
remove:
- conflict
Then, you pull request list will look like this on conflict:

Toggle a label based on CI status๐
pull_request_rules:
- name: toggle labels based on CI state
conditions:
- check-failure=CI
actions:
label:
toggle:
- "CI:fail"
Add a label based on the name of the branch๐
pull_request_rules:
- name: add a label with the name of the branch
conditions: []
actions:
label:
add:
- "branch:{{base}}"