Skip to content

Commit

Permalink
Add CI test that fails if a PR is issued to main (#1356)
Browse files Browse the repository at this point in the history
The `edited` activity type includes changes to the base branch, so we
need to add that to the trigger types. It also needs to run on
development as well as main, so the workflow can succeed once the base
branch is changed.

Do the check in bash, so we get "Successful" instead of "Skipped"
Co-authored-by: Eric T. Johnson <yut23@users.noreply.github.com>
  • Loading branch information
maxpkatz authored Apr 5, 2024
1 parent d82c8c8 commit e5fecb7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/check_pr_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: check PR branch

on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited

jobs:
check-PR-branch:
runs-on: ubuntu-latest
steps:
- name: PRs should not target main
run: |
if [[ "${{ github.base_ref }}" == "main" ]]; then
echo 'Pull requests must not be made against main. Please target development instead.'
exit 1
fi

0 comments on commit e5fecb7

Please sign in to comment.