Skip to content

Commit 5f7defb

Browse files
committed
Further optimizations and tweaks to the new GH action
Signed-off-by: Bernd Finger <bfinger@redhat.com>
1 parent 6490298 commit 5f7defb

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
name: Check source branch
1+
name: Check PR branches
22

33
on:
44
pull_request:
55
branches:
66
- main
7+
- dev
78
types:
89
- opened
910
- synchronize
1011
- reopened
12+
# Ensure re-check when branch is switched after PR is opened:
13+
- edited
1114

1215
jobs:
13-
check-source-branch:
16+
check-pr-branches:
1417
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
1520
steps:
16-
- name: Check if PR is from dev branch
17-
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'
1823
run: |
1924
echo "PRs to the main branch are only allowed from the dev branch!"
2025
exit 1

0 commit comments

Comments
 (0)