Skip to content

Commit 5efad47

Browse files
committed
Add PR branch check action
1 parent 7b4b2b7 commit 5efad47

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/pr-check.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Make sure PRs target the develop branch
2+
3+
on:
4+
pull_request_target:
5+
6+
# By default, pull_request_target gets write permissions to the repo - this prevents that
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
check-branch:
12+
if: github.event.pull_request.base.ref == 'master'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Add comment
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
github.rest.issues.createComment({
20+
issue_number: context.issue.number,
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
body: 'Please do not submit against `master`, use `develop` instead'
24+
})
25+
- name: Throw error
26+
run: |
27+
echo "::error title=wrong-branch::Please do not submit against 'master', use 'develop' instead"
28+
exit 1

0 commit comments

Comments
 (0)