Skip to content

Commit 8d58e86

Browse files
committed
chore: Prevent PRs targetting the master branch
1 parent 5dbbb1d commit 8d58e86

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Prevent PRs targetting master
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
prevent-pr-targetting-master:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Post comment to update base branch
13+
run: gh pr comment ${{ github.event.pull_request.number }} --body "⚠️ Pull requests targetting the `master` branch are not allowed. Please update the base branch to `next`."
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
- name: Close PR
17+
run: gh pr close ${{ github.event.pull_request.number }} --repo ${{ github.repository }}
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)