From 2743376c60c3673d76f07ddd4607075b4d42cabd Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Wed, 13 Nov 2024 15:40:08 -0500 Subject: [PATCH] cicd: warn when merging to main --- .github/workflows/branch-warning.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/branch-warning.yaml diff --git a/.github/workflows/branch-warning.yaml b/.github/workflows/branch-warning.yaml new file mode 100644 index 00000000..e76ddd22 --- /dev/null +++ b/.github/workflows/branch-warning.yaml @@ -0,0 +1,19 @@ +name: PR branch check + +on: + pull_request: + branches: + - main + +jobs: + check_branch: + runs-on: ubuntu-latest + steps: + - name: Check PR Source Branch + if: github.event.pull_request.head.ref != 'staging' + run: | + echo "Checking if PR is coming from 'staging' branch" + gh pr comment ${{ github.event.pull_request.number }} \ + --body "Hey bud, you're opening a PR to main from a branch that isn't staging. Maybe you know what you're doing, but maybe you also just forgot to change the branch. Take a second to think about it." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}