Skip to content

Commit 90e8ffd

Browse files
committed
add github action to check PR base branch
Reject any PRs not based against dev branch. This should hopefully help us avoid accidentally merging PRs against master.
1 parent d3ba8ca commit 90e8ffd

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Check PR Base
2+
on:
3+
pull_request:
4+
types: [opened, edited]
5+
jobs:
6+
check-pr-base:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Reject PR due to incorrect base
10+
if: github.base_ref != 'dev' && (github.event.action == 'opened' || (github.event.action == 'edited' && github.event.changes.base.ref))
11+
uses: andrewmusgrave/automatic-pull-request-review@0.0.5
12+
with:
13+
repo-token: ${{ secrets.GITHUB_TOKEN }}
14+
event: REQUEST_CHANGES
15+
body: 'Please change your PR base to dev branch.'
16+
- name: Approve PR because it's based against dev branch
17+
if: github.base_ref == 'dev' && github.event.changes.base && github.event.changes.base.ref.from != 'dev'
18+
uses: andrewmusgrave/automatic-pull-request-review@0.0.5
19+
with:
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}
21+
event: APPROVE
22+
body: 'Your PR is based against the dev branch. Looks good.'

0 commit comments

Comments
 (0)