From e5fecb7a81f0263128a417e1d02d15691e55594a Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 5 Apr 2024 19:10:49 -0400 Subject: [PATCH] Add CI test that fails if a PR is issued to main (#1356) 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 --- .github/workflows/check_pr_branch.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/check_pr_branch.yml diff --git a/.github/workflows/check_pr_branch.yml b/.github/workflows/check_pr_branch.yml new file mode 100644 index 0000000000..3543088221 --- /dev/null +++ b/.github/workflows/check_pr_branch.yml @@ -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