chore: add .github/workflows/main-source-guard.yml for main branch policy

Signed-off-by: MrAlders0n <MrAlders0n@smal.ca>
This commit is contained in:
MrAlders0n committed 2026-10-03 20:06:06 -04:00
1 parent 0e2fac731c
commit b4d498e697
1 file changed
+24
+24
View File
@@ -0,0 +1,24 @@
name: Main PR source guard
# Runs from main's copy of this file, so a PR can't edit the check away.
on:
pull_request_target:
branches: [main]
types: [opened, reopened, synchronize, edited]
permissions: {}
jobs:
main-source-is-dev:
name: main-source-is-dev
runs-on: ubuntu-latest
steps:
- name: Require PR from this repo's dev branch
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
run: |
if [ "$HEAD_REF" != "dev" ] || [ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ]; then
echo "::error::PRs into main must come from $GITHUB_REPOSITORY:dev (got $HEAD_REPO:$HEAD_REF)"
exit 1
fi