Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timonvs/pr-labeler-action
Automatically labels your PRs based on branch name patterns like feature/* or fix/*.
https://github.com/timonvs/pr-labeler-action
actions github github-actions
Last synced: 15 days ago
JSON representation
Automatically labels your PRs based on branch name patterns like feature/* or fix/*.
- Host: GitHub
- URL: https://github.com/timonvs/pr-labeler-action
- Owner: TimonVS
- License: mit
- Created: 2019-04-06T12:37:20.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-13T13:55:00.000Z (9 months ago)
- Last Synced: 2024-10-25T14:14:32.320Z (20 days ago)
- Topics: actions, github, github-actions
- Language: TypeScript
- Homepage:
- Size: 1.17 MB
- Stars: 246
- Watchers: 2
- Forks: 52
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PR Labeler
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
A GitHub Action that automatically applies labels to your PRs based on branch name patterns like `feature/*` or `fix/*`.
Can be used in combination with [Release Drafter](https://github.com/toolmantim/release-drafter) to automatically [categorize pull requests](https://github.com/toolmantim/release-drafter#categorize-pull-requests).## Usage
Add `.github/workflows/pr-labeler.yml` with the following:
```yml
name: PR Labeler
on:
pull_request:
types: [opened]permissions:
contents: readjobs:
pr-labeler:
permissions:
contents: read # for TimonVS/pr-labeler-action to read config file
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
```## Configuration
Configure by creating a `.github/pr-labeler.yml` file.
For example:
```yml
feature: ['feature/*', 'feat/*']
fix: fix/*
chore :hammer:: chore/*
```Then if a pull request is opened with the branch name `feature/218-add-emoji-support` the Action will automatically apply the `feature` label.
Similarly, if a pull requests is opened with the branch name `fix/weird-bug` or `chore/annual-refactoring-job`, the Action will apply the `fix` or `chore 🔨` label, respectively.
If the label does not exist in your repo, a new one will be created (with no color and blank description), but it will not be permanently saved to the `github.com//labels` page.
### Wildcard branches in configuration
You can use `*` as a wildcard for matching multiple branch names. See https://www.npmjs.com/package/matcher for more information about wildcard options.
### Default configuration
When no configuration is provided, the following defaults will be used:
```yml
feature: ['feature/*', 'feat/*']
fix: 'fix/*'
chore: 'chore/*'
```## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Timon van Spronsen
💻 🤔 ⚠️ 📖
Clemens Bastian
💻 📖 🐛
Hugo van Rijswijk
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!