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-head-branch
Restrict pull requests to only be able to be created on specific branches.
Create a workflow file under .github/workflows
directory.
name: Restrict head branch
on:
pull_request_target:
types: [opened, edited, synchronize]
jobs:
restrict-head-branch:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: agaroot-technologies/action-restrict-head-branch@v1
with:
rules: |
main staging development
feature/* bugfix/* refactor/* chore/* deps/*
A list of rules that restrict pull requests to be created from only certain branches.
Each rule is a list of branch patterns separated by spaces.
If you want to create pull requests only from the main, staging, and development branches, configure as follows.
rules: |
main staging development
You can also use Glob to specify the branch name.
Minimatch is used for the matching process.
If you want to create only pull requests from feature and bug fix branches, configure as follows.
rules: |
feature/* bugfix/*
Also, line breaks can be inserted for readability, as shown below.
rules: |
main staging development
feature/* bugfix/* refactor/* chore/* deps/*
This is equivalent to the following rule.
rules: |
main staging development feature/* bugfix/* refactor/* chore/* deps/*
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.