From b9958ea98457c5c73439dfa9fa57b73e37644a75 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Mon, 4 May 2026 19:34:49 -0500 Subject: [PATCH] =?UTF-8?q?enforce=20source=20branch=20in=20CI:=20stage?= =?UTF-8?q?=E2=86=90dev,=20main=E2=86=90stage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci-stage.yaml | 10 ++++++++++ .gitea/workflows/release.yaml | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/.gitea/workflows/ci-stage.yaml b/.gitea/workflows/ci-stage.yaml index 7b74b74..4abd0fb 100644 --- a/.gitea/workflows/ci-stage.yaml +++ b/.gitea/workflows/ci-stage.yaml @@ -16,6 +16,16 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Enforce source branch (stage ← dev only) + if: github.event_name == 'pull_request' + run: | + SOURCE="${GITHUB_HEAD_REF}" + if [ "${SOURCE}" != "dev" ]; then + echo "ERROR: Stage branch only accepts PRs from 'dev'. Source was: '${SOURCE}'" + exit 1 + fi + echo "Source branch check passed: ${SOURCE} → stage" + - name: Install build dependencies run: | apt-get update -qq diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index e306362..38c7d2b 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -18,6 +18,16 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Enforce source branch (main ← stage only) + if: github.event_name == 'pull_request' + run: | + SOURCE="${GITHUB_HEAD_REF}" + if [ "${SOURCE}" != "stage" ]; then + echo "ERROR: Main branch only accepts PRs from 'stage'. Source was: '${SOURCE}'" + exit 1 + fi + echo "Source branch check passed: ${SOURCE} → main" + - name: Install build dependencies run: | apt-get update -qq