From a4d7ae12f0af853da5d09a2bf51a872355a73ee2 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Thu, 4 Sep 2025 15:35:39 -0700 Subject: [PATCH] ci: main branch protection (#4443) --- .github/workflows/main-protect.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/main-protect.yml diff --git a/.github/workflows/main-protect.yml b/.github/workflows/main-protect.yml new file mode 100644 index 00000000..b9d8dc36 --- /dev/null +++ b/.github/workflows/main-protect.yml @@ -0,0 +1,18 @@ +name: Main Branch Protection + +on: + pull_request: + branches: + - main + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Check branch + run: | + if [[ ${GITHUB_HEAD_REF} != canary ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^v[0-9]+\.[0-9]+\.[0-9]+-staging$ ]]; + then + echo "Error: Pull request must come from 'canary' or 'v*.*.*-staging' branch" + exit 1 + fi