This GitHub Action automatically adds given labels to pull requests based on the title of the pull request.
It does this by checking if the title of the pull request contains any word or phrase enclosed in a bracket (eg [HOTFIX]: This is a hotfix
); if it does, it automatically adds the label to the pull request.
Required The GitHub token to use for authentication. Typically, this should be set to ${{ secrets.GITHUB_TOKEN }}
.
Optional The default label to add to pull requests if no label is found in the title of the pull request. Default: pending-review
.
-
Create a Workflow YAML File: In your repository, create or edit a workflow YAML file (e.g.,
.github/workflows/pr-labels.yml
). -
Define the Workflow:
name: Auto Add Label to PRs
on:
pull_request:
types:
- opened
- reopened
jobs:
add_labels:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Add Labels to PR
uses: UcheSylvester/pr-labelr@v0.1.1
with:
default-label: some-label
github-token: ${{ secrets.GITHUB_TOKEN }}
To run this action locally, you need to have Node.js installed on your machine.
- Clone this repository:
git clone
- Install dependencies:
yarn
- Build the typescript:
yarn build
- Run the tests:
yarn test
- Run the local action with nektos/act:
act -j pr-labelr -s GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
We welcome contributions from the community to make Pr Labelr even better. Whether it's bug fixes, new features, or improvements to documentation, your input is valuable. To contribute, follow these steps:
- Create an issue describing the feature/bug you want to work on.
- Fork the repository on GitHub.
- Create a new branch for your changes.
- Make your changes and commit them with descriptive messages.
- Submit a pull request to the main repository.
This project is licensed under the MIT License - see the LICENSE file for details.
Email | Follow on Twitter | Connect on LinkedIn | Report an Issue