Renato66 / auto-label

Auto Label Issue Based on Issue Description

Home Page:https://renato66.github.io/auto-label/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 specific issues will be much easier.

Warning

The main branch is being refactored, use the stable one at master subscribe to v3 to get the latest version when it's released

Creating

Check out the app to make a YAML file here.

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: Renato66/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 automatically by GitHub; just need to add

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

Change bot appearance

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 which labels are available 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 upon 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 an 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/Renato66/auto-label)

About

Auto Label Issue Based on Issue Description

https://renato66.github.io/auto-label/

License:MIT License


Languages

Language:TypeScript 93.6%Language:Dockerfile 6.4%