Git Product home page Git Product logo

issue-labeler's Introduction

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)'

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]

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        not-before: 2020-01-15T02:54:32Z
        enable-versioned-regex: 0

not-before is optional and will result in any issues prior to this timestamp to be ignored. Note: This grants access to the GITHUB_TOKEN so the action can make calls to GitHub's rest API

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.

<!--
issue_labeler_regex_version=1
--!>

I have an urgent issue that requires someone's attention.

Below is the workflow file

name: "Issue Labeler"
on:
  issues:
    types: [opened, edited]

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        not-before: 2020-01-15T02:54:32Z
        enable-versioned-regex: 1
        versioned-regex: 'issue_labeler_regex_version=(\d+)'
        body-missing-regex-label: 'broken-template'

When the issue is evaluated it'll look for .github/labeler-v1.yml based on the configuration-path and the version number set in the issue.

When you reach a point where you'd like to update your labels and regular expressions and it could cause a conflict with historic issues, simply update your issue template to include issue_labeler_regex_version=2 and create the file .github/labeler-v2.yml. The issue will automatically be matched to the correct set of regular expressions.

Set versioned-regex to any valid regular expression that should be used to capture the version number from the issue. The first match will be used should multiple be found.

Set body-missing-regex-label to the name of the label that should be added to an issue where the specified version-regex can't be found. This is useful for when your users accidentally delete this value. Leave this blank if you don't want to use this functionality.

issue-labeler's People

Contributors

stephanmiehe avatar cgreene avatar jinzhu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.