-
-
Notifications
You must be signed in to change notification settings - Fork 426
29 lines (23 loc) · 823 Bytes
/
pr-target-check.yml
File metadata and controls
29 lines (23 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: PR Target Check
on:
pull_request:
types: [opened, reopened, edited, synchronize]
jobs:
check-target:
runs-on: ubuntu-latest
steps:
- name: Enforce branch strategy
run: |
BASE="${{ github.event.pull_request.base.ref }}"
HEAD="${{ github.event.pull_request.head.ref }}"
echo "PR: $HEAD → $BASE"
if [ "$BASE" = "master" ] && [ "$HEAD" != "develop" ]; then
echo "❌ Only the 'develop' branch can open PRs to 'master'."
echo " Please target 'develop' instead."
exit 1
fi
if [ "$BASE" = "develop" ] && [ "$HEAD" = "master" ]; then
echo "❌ Do not merge 'master' back into 'develop'."
exit 1
fi
echo "✅ PR target is valid: $HEAD → $BASE"