PR labeler
Pull Request Labeler - A github action to add labels on pull request(use commits files)
Project is refer from https://github.com/paulfantom/periodic-labeler
Usage
Create .github/labeler.yml
Create a .github/labeler.yml
file with a list of labels and match globs 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 path (glob) of the changed files (eg: src/**/*
, tests/*.spec.js
)
Basic Examples
# Add 'label1' to any changes within 'example' folder or any subfolders
label1:
- example/**/*
# Add 'label2' to any file changes within 'example2' folder
label2: example2/*
Common Examples
# Add 'repo' label to any root file changes
repo:
- ./*
# Add '@domain/core' label to any change within the 'core' package
@domain/core:
- package/core/*
- package/core/**/*
# Add 'test' label to any change to *.spec.js files within the source dir
test:
- src/**/*.spec.js
Create Workflow
Create a workflow (eg: .github/workflows/pr-labeler.yml
see Creating a Workflow file) to utilize the labeler action with content:
name: "Pull Request Labeler"
on:
- pull_request
jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: hi-actions/pr-labeler@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LABEL_CONFIG: .github/labeler.yml # this is default
Note: This grants access to the GITHUB_TOKEN
so the action can make calls to GitHub's rest API
Refer Projects
Refer Documents