From 7c4a94944cdfd40b033e46ebe11b552d7e48eb92 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Sat, 3 Oct 2026 09:56:47 -0700 Subject: [PATCH] ci: fail PRs that carry upstream issue/PR refs or closing keywords Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_0163hpDCucArS53wRsiLQDw7 --- .github/workflows/upstream-ref-check.yml | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/upstream-ref-check.yml diff --git a/.github/workflows/upstream-ref-check.yml b/.github/workflows/upstream-ref-check.yml new file mode 100644 index 0000000000..33b8554568 --- /dev/null +++ b/.github/workflows/upstream-ref-check.yml @@ -0,0 +1,31 @@ +name: Upstream ref check + +# Fails if a PR title/body or our own (first-parent) commit messages carry +# upstream issue/PR refs or closing keywords. See combines/pr-split-plan.md. +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Scan title, body and first-parent commits + env: + PR_TITLE: ${{ github.event.pull_request.title }} + PR_BODY: ${{ github.event.pull_request.body }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + PAT='([Ff]ix(e[sd])?|[Cc]lose[sd]?|[Rr]esolve[sd]?)[: ]+[A-Za-z0-9_./-]*#[0-9]+|[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+#[0-9]+|github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+/(issues|pull)/[0-9]+' + if { printf '%s\n%s\n' "$PR_TITLE" "$PR_BODY"; git log --first-parent --format='%h %B' "$BASE_SHA..$HEAD_SHA"; } \ + | grep -nE "$PAT" | grep -v 'github.com/prokrypt/'; then + echo "::error::Remove upstream refs/closing keywords (list commits as 'sha subject' only)" + exit 1 + fi