From 48509aa5f475aeea547e9bf6b5837ce0b8a70024 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Mon, 4 May 2026 19:34:42 -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 508bb9f..44a478f 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 7854626..aff04f8 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -16,6 +16,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