From 2349867090090f53cb9b92d8ee71c1ffbcaf3870 Mon Sep 17 00:00:00 2001 From: Zac Clifton <43915749+Cliftonz@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:18:44 -0400 Subject: [PATCH] Add Github action to validate PR source branch This commit introduces a new Github Action workflow that checks the source branch of pull requests. The action ensures that only changes from the "next" branch can enter the "prod" branch. --- .github/workflows/on-pr-change.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/on-pr-change.yml diff --git a/.github/workflows/on-pr-change.yml b/.github/workflows/on-pr-change.yml new file mode 100644 index 00000000000..1c789ad05b1 --- /dev/null +++ b/.github/workflows/on-pr-change.yml @@ -0,0 +1,18 @@ +name: Check pull request source branch +on: + pull_request_target: + types: + - opened + - reopened + - synchronize + - edited +jobs: + check-branches: + runs-on: ubuntu-latest + steps: + - name: Check branches + run: | + if [ ${{ github.head_ref }} != "next" ] && [ ${{ github.base_ref }} == "prod" ]; then + echo "Merge requests to prod branch are only allowed from next branch." + exit 1 + fi