ci: reject PRs that reference the assistant by name in title/body/commits

Server-side counterpart to the global commit-msg hook (which blocks the same word
locally, but can be bypassed with --no-verify or via GitHub UI edits). Checks only
message text, never file contents.
This commit is contained in:
2026-07-02 03:42:04 -07:00
parent bd644ea905
commit 373ddcaca8

41
.github/workflows/no-claude.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: No Claude references
# Server-side counterpart to the global commit-msg hook: rejects a PR whose
# title, body, or commit messages mention "claude" (any case). Catches commits
# pushed with --no-verify and edits made in the GitHub UI. Only message text is
# checked — never file contents, since the code legitimately references claude.
on:
pull_request:
types: [opened, edited, reopened, synchronize]
permissions:
contents: read
jobs:
no-claude:
runs-on: ubuntu-latest
steps:
- name: Check PR title and body
env:
TITLE: ${{ github.event.pull_request.title }}
BODY: ${{ github.event.pull_request.body }}
run: |
if printf '%s\n%s' "$TITLE" "$BODY" | grep -qi 'claude'; then
echo "::error::PR title or body mentions 'claude' — please remove it."
exit 1
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check commit messages
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if git log --format='%B' "$BASE_SHA..$HEAD_SHA" | grep -qi 'claude'; then
echo "::error::A commit message in this PR mentions 'claude'."
exit 1
fi