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.
42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
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
|