⭐️ Support the project by giving it a star!
Automatically add labels by filtering the title and comment of issues and pull requests.
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| 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> |
issuespull_request |
- Optional - List of events to filter - Default: [issues, pull_request] |
targets |
List<Target> |
titlecomment |
- Optional - List of target to filter - Default: [title, comment] |
regexsproperty
Syntax:
/pattern/modifier(s)
patternmust be written between/and/modifieris optionalmodifiervalues:i,m,u,yex)
/bug/,/bug/im,/\bFeat\b/iReferences:
# 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/issue-pr-labeler@v2
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_targetevent to allow Labeler to work even when you open a pull request from a forked repository to an upstream repository.
| 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 |
The scripts and documentation in this project are released under the MIT License