From 2424125d2241c9bb5252cdff63b7c7874e34694b Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 2 Feb 2026 19:46:08 +0100 Subject: [PATCH] Add workflow to block merges to main from non-release branches --- .github/workflows/block-main-non-release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/block-main-non-release.yml diff --git a/.github/workflows/block-main-non-release.yml b/.github/workflows/block-main-non-release.yml new file mode 100644 index 0000000..26fa178 --- /dev/null +++ b/.github/workflows/block-main-non-release.yml @@ -0,0 +1,19 @@ +name: Block main merges from non-release branches + +on: + pull_request: + types: [opened, reopened, synchronize, edited] + branches: [main] + +jobs: + enforce: + runs-on: ubuntu-latest + steps: + - name: Ensure PR comes from release/* + run: | + echo "Base: ${{ github.base_ref }}" + echo "Head: ${{ github.head_ref }}" + if [[ "${{ github.head_ref }}" != release/* ]]; then + echo "::error::PRs to main are only allowed from release/* branches." + exit 1 + fi