1 parent 6490298 commit 5f7defbCopy full SHA for 5f7defb
1 file changed
.github/workflows/pr-branch-check.yml
@@ -1,20 +1,25 @@
1
-name: Check source branch
+name: Check PR branches
2
3
on:
4
pull_request:
5
branches:
6
- main
7
+ - dev
8
types:
9
- opened
10
- synchronize
11
- reopened
12
+ # Ensure re-check when branch is switched after PR is opened:
13
+ - edited
14
15
jobs:
- check-source-branch:
16
+ check-pr-branches:
17
runs-on: ubuntu-latest
18
+ # Only run if it is not an edit OR if it is an edit to the base branch:
19
+ if: github.event.action != 'edited' || github.event.changes.base.ref.from != null
20
steps:
- - name: Check if PR is from dev branch
- if: github.head_ref != 'dev'
21
+ - name: Check if PR to main is from dev branch
22
+ if: github.base_ref == 'main' && github.head_ref != 'dev'
23
run: |
24
echo "PRs to the main branch are only allowed from the dev branch!"
25
exit 1
0 commit comments