The Auto label action will check for every new issue and automatically adds a label based on the body of the issue. This means that finding specifc issues will be much more easy.
Check out the app to make yml file https://nikskiz.github.io/auto-label/
or
add a file to .github/workflows/issue.yml
name: Labeling new issue
on:
issues:
types: ['opened']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: nikskiz/auto-label@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
ignore-comments: true
labels-synonyms: '{"bug":["error","need fix","not working"],"enhancement":["upgrade"],"question":["help"]}'
labels-not-allowed: '["good first issue"]'
default-labels: '["help wanted"]'
Name | Description | Required | Default | Examples |
---|---|---|---|---|
repo-token | Github token for the repository | true | - | ... |
ignore-comments | Ignore labels inside issue comments | false | true | ... |
labels-synonyms | Text synonyms for labels | false | - | ... |
labels-not-allowed | Labels to ignore | false | - | ... |
default-labels | Labels that will always be set | false | - | ... |
Repo token is provided automaticly by github just need to add
repo-token: ${{ secrets.GITHUB_TOKEN }}
If you want to change who added the labels, you can provide a user token
The token will only need the public_repo
scope
You will need to provide it as secret GITHUB_USER_TOKEN
and update the issue.yml repo-token with:
repo-token: ${{ secrets.GITHUB_USER_TOKEN }}
If you prefer to leave as default (true) You can provide a list of labels in a template for the author to choose wich labels are avaliable to pick But if you prefer to set it as false, the author can set the labels inside a comment so it doesn't appear on issue body
You can set a custom part of your issue/pr to be labeled using this structure:
Some text that could have a label that wouldn't be set
<!-- AUTO-LABEL:START -->
Another text that could have a label and will be set as a label
<!-- AUTO-LABEL:END -->
thanks to @dielduarte and @PauloGoncalvesBH
Sometimes labels can be set uppon other texts, as an example, if you have a label like C: VCombobox
it would be hard to match the label in a normal issue, but you can provide a JSON to set it synonyms:
labels-synonyms: '{"C: VCombobox":["combobox","v-combobox","combo box"]}'
Some labels are restricted to repo owners such as needs priority
testing
won't fix
they can be set in an Array form:
labels-not-allowed: '["needs priority","testing","won't fix"]'
Labels that will always be set when a issue is created/updated such as triage
, they can be set in an Array form:
default-labels: '["triage"]'
To add a badge simple replace owner and repository
<!-- Replace <OWNER> and <REPOSITORY>. It assumes workflow name is "Labeling%20new%20issue" -->
[![Auto Label](https://github.com/<OWNER>/<REPOSITORY>/workflows/Labeling%20new%20issue/badge.svg)](https://github.com/nikskiz/auto-label)