Skip to content

nikskiz/auto-label

 
 

Repository files navigation

Auto-label

Unit test Auto Label codecov

image

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.

Creating

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"]'

Inputs

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

Repo token is provided automaticly by github just need to add

repo-token: ${{ secrets.GITHUB_TOKEN }}

Change bot apperance

If you want to change who added the labels, you can provide a user token

image

image

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 }}

Ignore Comments

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

Scoped blocks

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

Labels Synonyms

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"]}'

Labels Not Allowed

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"]'

Default Labels

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"]'

Badge

To add a badge simple replace owner and repository

Auto Label

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

About

Auto Label Issue Based on Issue Description

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 68.0%
  • JavaScript 31.7%
  • Dockerfile 0.3%