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 (#12665)
Browse files Browse the repository at this point in the history
* Add a github action to check the base branch

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.

* Name workflow
  • Loading branch information
dbkr authored Jun 20, 2024
1 parent e9abc55 commit 0317755
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/pull_request_base_branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Pull Request Base Branch
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 0317755

Please sign in to comment.