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