Merge pull request 'Enforce dev-only source on stage' (#12) from fix/stage-source-enforcement into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 17m6s

This commit was merged in pull request #12.
This commit is contained in:
2026-05-07 06:09:40 +00:00
+14 -10
View File
@@ -33,19 +33,23 @@ jobs:
steps: steps:
- name: Enforce dev-only source - name: Enforce dev-only source
# stage branch only accepts merges from dev. A direct push from any # stage only accepts merges from dev. Any PR from another branch fails
# other branch fails here so the rest of the pipeline never runs. # here before a single build step runs.
# workflow_dispatch is exempt (allows manual redeploy of current stage). # workflow_dispatch is exempt (allows manual redeploy of current stage).
if: github.event_name != 'workflow_dispatch' if: github.event_name != 'workflow_dispatch'
run: | run: |
BASE=$(git -C "$GITHUB_WORKSPACE" log --pretty=format:"%D" -1 2>/dev/null || true) set -euo pipefail
# On a merge-to-stage push the parent is the tip of dev. COMMIT_MSG=$(git log -1 --pretty=format:"%s" 2>/dev/null || true)
# We check the merge commit parents: if the non-stage parent is not echo "Merge commit: $COMMIT_MSG"
# from dev, reject. For direct pushes (no merge commit) the # Gitea merge commits: "Merge pull request '...' (#N) from dev into stage"
# committer origin cannot be verified here — branch protection # Direct branch merges: "Merge branch 'dev' into stage"
# (enable_push=false) blocks direct non-admin pushes before CI runs. if echo "$COMMIT_MSG" | grep -qE " from dev into stage$| 'dev' into stage$"; then
echo "Event: ${{ github.event_name }}, ref: ${{ github.ref }}" echo "Source branch check: OK (merged from dev)"
echo "Source branch enforcement: OK (protected by Gitea branch rules)" else
echo "ERROR: stage only accepts merges from dev."
echo "Commit message was: $COMMIT_MSG"
exit 1
fi
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4