https://github.com/step-security/pr-labeler-action
Automatically labels your PRs based on branch name patterns like feature/* or fix/*
https://github.com/step-security/pr-labeler-action
step-security-maintained-actions
Last synced: about 1 year ago
JSON representation
Automatically labels your PRs based on branch name patterns like feature/* or fix/*
- Host: GitHub
- URL: https://github.com/step-security/pr-labeler-action
- Owner: step-security
- License: mit
- Created: 2023-12-03T15:12:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T00:24:55.000Z (about 1 year ago)
- Last Synced: 2025-03-24T01:26:45.418Z (about 1 year ago)
- Topics: step-security-maintained-actions
- Language: TypeScript
- Homepage:
- Size: 2.12 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# StepSecurity Maintained `pr-labeler` Action
Forked from [TimonVS/pr-labeler-action](https://github.com/TimonVS/pr-labeler-action)
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: read
jobs:
pr-labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: step-security/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/*'
```