The Wayback Machine - http://web.archive.org/web/20241012234010/https://github.com/github/issue-labeler
Skip to content

github/issue-labeler

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Issue Labeler

Issue labeler will label issues based on the body content of the issue.

Usage

Create .github/labeler.yml

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.

Basic Examples

# Add/remove 'critical' label if issue contains the words 'urgent' or 'critical'
critical:
    - '(critical|urgent)'

Label All Issues

# Add 'critical' label to any issue that gets opened
critical:
    - '/.*/'

Create Workflow

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.

Example using versioned issue templates

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.

{"resolvedServerColorMode":"day"}