Skip to content

Commit

Permalink
add github action to check PR base branch
Browse files Browse the repository at this point in the history
Reject any PRs not based against dev branch.  This should hopefully help
us avoid accidentally merging PRs against master.
  • Loading branch information
ryannowarm committed Jul 21, 2021
1 parent d3ba8ca commit 90e8ffd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/check-pr-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check PR Base
on:
pull_request:
types: [opened, edited]
jobs:
check-pr-base:
runs-on: ubuntu-latest
steps:
- name: Reject PR due to incorrect base
if: github.base_ref != 'dev' && (github.event.action == 'opened' || (github.event.action == 'edited' && github.event.changes.base.ref))
uses: andrewmusgrave/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
event: REQUEST_CHANGES
body: 'Please change your PR base to dev branch.'
- name: Approve PR because it's based against dev branch
if: github.base_ref == 'dev' && github.event.changes.base && github.event.changes.base.ref.from != 'dev'
uses: andrewmusgrave/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
event: APPROVE
body: 'Your PR is based against the dev branch. Looks good.'

0 comments on commit 90e8ffd

Please sign in to comment.