Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Add a github action to check the base branch
Browse files Browse the repository at this point in the history
It should be very rare that we ever PR into a branch that isn't
'develop', 'staging' or a feature branch, and this will give us a
failed check when stacking up PRs on top of one another until the
one below it is merged.
  • Loading branch information
dbkr committed Jun 20, 2024
1 parent 1bf430b commit 7fb307c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/pull_request_base_branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
check_base_branch:
name: Check PR base branch
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
script: |
const baseBranch = context.payload.pull_request.base.ref;
if (!['develop', 'staging'].includes(baseBranch) && !baseBranch.startsWith('feat/')) {
core.setFailed(`Invalid base branch: ${baseBranch}`);
}

0 comments on commit 7fb307c

Please sign in to comment.