diff --git a/.github/workflows/no-claude.yml b/.github/workflows/no-claude.yml new file mode 100644 index 0000000..58fcaa9 --- /dev/null +++ b/.github/workflows/no-claude.yml @@ -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