Issue labeler will label issues based on the body content of the issue.
Create a .github/labeler.yml file with a list of labels and regex to match to apply the label.
The key is the name of the label in your repository that you want to add (eg: "merge conflict", "needs-updating") and the value is the regular expression for when to apply the label. Should the regular expression not match, the label will be removed.
# Add/remove 'critical' label if issue contains the words 'urgent' or 'critical'
critical:
- '(critical|urgent)'# Add 'critical' label to any issue that gets opened
critical:
- '/.*/'Create a workflow (eg: .github/workflows/labeler.yml see Creating a Workflow file) to utilize the labeler action with content:
name: "Issue Labeler"
on:
issues:
types: [opened, edited]
permissions:
issues: write
contents: read
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v3.3 #May not be the latest version
with:
configuration-path: .github/labeler.yml
not-before: 2020-01-15T02:54:32Z
enable-versioned-regex: 0
repo-token: ${{ github.token }}not-before is optional and will result in any issues prior to this timestamp to be ignored.
As you iterate on your regular expressions, since maybe your issue template gets updated, this can have an impact on existing issues. The below allows you to version your regular expression definitions and pair them with issue templates.
Below is the body of an example issue which has the version identifier issue_labeler_regex_version embedded.

