Automatically adds or removes labels from issues, pull requests and project cards.
issuespull_requestproject_card
to add or remove labels the parameters are:
add-labelsremove-labels
They may receive multiple labels separated by commas. They also may be used together.
add-labels: 'label1, label2'
remove-labels: 'label3, label4'name: issue-automation
on:
issues:
types: [opened]
pull_request:
types: [opened]
project_card:
types: [moved]
jobs:
automate-issues-labels:
runs-on: ubuntu-latest
steps:
- name: initial labeling
uses: andymckay/labeler@master
with:
add-labels: "needs-triage, bug"
remove-labels: "in progress"
This runs on 3 types of events:
issuescreationpull_requestcreationproject_cardmove
This adds the labels:
needs-triagebug
And removes the label in progress.
The parameter ignore-if-assigned checks at the time of the action running if the issue has been assigned to anyone. If set to True and the issue is assigned to anyone, then no labels will be added or removed. This can be helpful for new issues that immediatly get labels or assignees and don't require any action to be taken.
An example use-case would be, to remove the help-wanted label when an issue is assigned to someone. For this, the workflow file would look like:
name: issue-automation
on:
issues:
types: [assigned]
jobs:
automate-issues-labels:
runs-on: ubuntu-latest
steps:
- uses: andymckay/labeler@master
with:
remove-labels: "help-wanted"
ignore-if-assigned: falseThe parameter ignore-if-labeled checks at the time of the action running if the issue has been labeled. If set to True and the issue is labeled, then no labels will be added or removed. This can be helpful for new issues that immediatly get labels or assignees and don't require any action to be taken.
An example use-case would be, to add the needs-triage label when an issue is oppened without labels. For this, the workflow file would look like:
name: issue-automation
on:
issues:
types: [opened]
jobs:
automate-issues-labels:
runs-on: ubuntu-latest
steps:
- uses: andymckay/[email protected]
with:
add-labels: "needs-triage"
ignore-if-labeled: true