Skip to content

Issue PR Labeler

Actions
Automatically add labels by filtering the title and comment of issues and pull requests.
v2.0.0
Latest
Star (5)

Issue PR Labeler

GitHub Release GitHub License npm Build codecov

About

Automatically add labels by filtering the title and comment of issues and pull requests.


Usage

YAML configuration

Create .github/labeler-config.yml file.

# example
filters:
  - label: feat
    regexs:
      - /\bfeat\b/
      - /feature/i
    events: [issues, pull_request]
    targets: [title, comment]
  - label: bug
    regexs:
      - /fix|bug/
    targets: [title]
  - label: documentation
    regexs:
      - /docs/
    events: [pull_request]
  - label: chore
    regexs:
      - /\bchore(\(.*\))?:/i

Properties

Key Type Value Description
label String label name - Required
- Label name to be added
regexs List<String> regular expression - Required
- List of regular expressions to filter
- Syntax: /pattern/modifier(s)
events List<Event> issues
pull_request
- Optional
- List of events to filter
- Default: [issues, pull_request]
targets List<Target> title
comment
- Optional
- List of target to filter
- Default: [title, comment]

regexs property


Workflow

# example
name: Issue PR Labeler

on:
  issues:
    types:
      - opened
      - edited
  pull_request: # or pull_request_target
    types:
      - opened
      - reopened

jobs:
  main:
    runs-on: ubuntu-latest

    permissions:
      contents: read       # required to read configuration yml file
      issues: write        # required to add labels to issues
      pull-requests: write # required to add labels to pull requests

    steps:
      - name: Run Issue PR Labeler
        uses: hoho4190/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
#          disable-bot: true
#          config-file-name: labeler-config.yml
  • Available events: issues, pull_request, pull_request_target
  • Use the pull_request_target event to allow Labeler to work even when you open a pull request from a forked repository to an upstream repository.

Input

Key Type Description
token String - Required
- Use ${{ secrets.GITHUB_TOKEN }}
disable-bot Boolean - Optional
- Whether to forbid filtering on issues and pull requests created by bots.
- Default: true
config-file-name String - Optional
- Configuration file(yaml) name.
- This file should be located in .github path.
- Default: labeler-config.yml

License

The scripts and documentation in this project are released under the MIT License

Issue PR Labeler is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Automatically add labels by filtering the title and comment of issues and pull requests.
v2.0.0
Latest

Issue PR Labeler is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.