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-base-branch
Restrict pull requests to merge only into specific branches.
Create a workflow file under .github/workflows
directory.
name: Restrict base branch
on:
pull_request_target:
types: [opened, edited, synchronize]
jobs:
restrict-base-branch:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: agaroot-technologies/action-restrict-base-branch@v1
with:
rules: |
main <- development
development <- feature/* bugfix/* refactor/* chore/* deps/*
feature/* <- feature/**/*
A list of rules that restrict pull requests to be merged into only certain branches.
Each rule is a list of branch patterns separated by <-
.
The left-hand side specifies the name of the base branch, and the right-hand side specifies the name of the head branch.
If you want to merge only development branches into the main branch, configure as follows.
rules: |
main <- development
Multiple branch names can be specified on the right side, separated by spaces.
rules: |
main <- development staging
You can also use Glob to specify the branch name.
Minimatch is used for the matching process.
If you want to merge only feature and bugfix branches into the development branch, configure as follows.
rules: |
development <- feature/* bugfix/*
Also, multiple rules can be specified by adding a new line as shown below.
rules: |
main <- development
development <- feature/* bugfix/*
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.