Caution
The repository has been archived and will no longer be maintained.
Moving forward, maintenance will be conducted in the following repository:
https://github.com/praha-inc/action-restrict-pr-label
Restrict pull request labels based on the combination of the base and head branches.
Create a workflow file under .github/workflows
directory.
name: Restrict pr label
on:
pull_request_target:
types: [opened, edited, synchronize]
jobs:
restrict-pr-label:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: agaroot-technologies/action-restrict-pr-label@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
rules: |
main <- staging [release] [production]
staging <- development [release] [staging]
development <- feature/* [feature]
development <- bugfix/* [bugfix]
development <- refactor/* [refactor]
development <- chore/* [chore]
development <- deps/* [deps]
A list of rules that restrict labels for pull requests based on the combination of base and head branches.
Each rule is a list of branch patterns separated by <-
and label names enclosed in []
.
If you want to add a release label when you submit a PR from the development branch to the main branch, configure as follows.
rules: |
main <- development [release]
Multiple label names can be specified, separated by spaces.
rules: |
main <- development [release] [production]
You can also use Glob to specify the branch name.
Minimatch is used for the matching process.
If you want to add a feature label when submitting a PR from a feature branch to a development branch, configure as follows
rules: |
development <- feature/* [feature]
Also, multiple rules can be specified by adding a new line as shown below.
rules: |
main <- development [release]
development <- feature/* [feature]
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.
Copyright © 2020 AGAROOT TECHNOLOGIES.
This project is MIT
licensed.