Repository navigation
docs: enforce Assisted-By attribution in PR descriptions - #654
Conversation
PR descriptions had no attribution guard: Claude Code's default 'Generated with Claude Code' / 🤖 footer was reaching PRs, while commits are already rewritten to Assisted-By by scripts/hooks/commit-msg. - CLAUDE.md: add a PR Description Attribution section so every contributor's Claude Code session overrides the default footer - CONTRIBUTING.md: add an Attribution section covering both commits (hook-handled) and PR bodies (manual rule) - .github/workflows/pr-attribution.yml: CI check that rejects PR bodies containing the prohibited footers; reads the event payload so it needs no checkout or token and works for fork PRs Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
This adds a PR-body attribution rule to CLAUDE.md and CONTRIBUTING.md, plus a small pull_request workflow that fails on prohibited AI-attribution footers. The workflow is safe: the body goes through env: (no ${{ }} in run:), it needs no checkout, no third-party actions and no token, and it works for forks. No blocking issues. I have three suggestions. The workflow only triggers on opened/edited, so it never reports on new pushes. The unanchored 🤖 / made-with patterns false-positive on ordinary prose. And CONTRIBUTING describes the commit-msg hook slightly inaccurately.
Author: pdettori (MEMBER — maintainer)
Areas reviewed: CI/GitHub Actions, Docs, agent instructions (CLAUDE.md)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (incl. the new PR attribution / check on this PR)
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited] |
There was a problem hiding this comment.
suggestion: The opened/edited trigger is fine if this is only advisory. If you mark PR attribution / check as a required status check, it breaks, because required checks are tied to the head SHA. After any new push (synchronize) or a reopened, no run exists for the new head, and the PR waits on a check that never reports. The job takes about 3 seconds, so I'd use types: [opened, edited, reopened, synchronize] and drop the line in the header comment saying the body doesn't change on new pushes.
There was a problem hiding this comment.
Fixed in 1653bf5 — triggers are now [opened, edited, reopened, synchronize] and the comment line is dropped. Required checks being head-SHA-tied was the gap; at ~3s per run, synchronize is cheap.
|
|
||
| # Same forbidden strings as the PR Description Attribution section in | ||
| # CLAUDE.md / CONTRIBUTING.md. Assisted-By is the accepted form. | ||
| if body | grep -qiE 'generated with claude|created with claude|made with claude|made-with|🤖'; then |
There was a problem hiding this comment.
suggestion: Two of these alternatives are unanchored substrings, so they reject ordinary descriptions:
🤖anywhere fails e.g. "Fixes the 🤖 bot labeler" or a pasted Dependabot/Renovate snippet.made-withmatchesMade-without-tests,home-made-with, and so on.
Anchoring the emoji and Made-with: to the start of a line still catches every footer variant the PR body lists. I tested this locally:
| if body | grep -qiE 'generated with claude|created with claude|made with claude|made-with|🤖'; then | |
| if body | grep -qiE '(generated|created|made) with \[?claude|^[[:space:]]*made-with:|^[[:space:]]*🤖'; then |
It fails on 🤖 Generated with [Claude Code](…), a bare 🤖, Made-with: Cursor, and Generated with Claude Code. It passes on Fixes the 🤖 bot labeler, home-made-with care, and Assisted-By: Claude Code. It also narrows the self-quoting limitation you describe to quotes that start a line or use the exact phrase.
There was a problem hiding this comment.
Adopted your regex verbatim in 1653bf5. Tested against 13 vectors — all footer variants reject (emoji-only, markdown-link, Made-with: Cursor, plain); prose (Fixes the 🤖 bot labeler, home-made-with care, Made-without-tests), Assisted-By, and empty bodies pass.
| types: [opened, edited] | ||
|
|
||
| permissions: | ||
| contents: read |
There was a problem hiding this comment.
nit: The step only reads the event payload, so it needs no token scopes. permissions: {} would match security-scans.yml and the "no token" claim in the header comment.
There was a problem hiding this comment.
Fixed in 1653bf5 — permissions: {}, matching security-scans.yml.
| # CLAUDE.md / CONTRIBUTING.md. Assisted-By is the accepted form. | ||
| if body | grep -qiE 'generated with claude|created with claude|made with claude|made-with|🤖'; then | ||
| echo "::error::PR description contains a prohibited AI-attribution footer." | ||
| echo "::error::Remove 'Generated with Claude Code' / 'Created with Claude Code' / the 🤖 line, and use 'Assisted-By: Claude Code' instead (see CONTRIBUTING.md, Attribution)." |
There was a problem hiding this comment.
nit: The error message doesn't mention Made-with, but the check rejects it. Add it to the list so a failing author knows what to remove.
| GitHub parses as co-authorship (they inflate contributor stats): | ||
|
|
||
| - **Commits**: the `commit-msg` hook installed by `pre-commit install` rewrites | ||
| `Co-authored-by:` and `Made-with:` lines naming an AI to a single |
There was a problem hiding this comment.
suggestion: This doesn't quite match scripts/hooks/commit-msg on main:
Made-with:lines are stripped whether or not they name an AI. They don't trigger theAssisted-Bytrailer. That's only added when aCo-authored-by:line matchesClaude|Cursor|anthropic. So a commit whose only marker isMade-with: Cursorends up with no attribution.- "naming an AI" only covers Claude, Cursor, and Anthropic.
Suggested wording: "strips Made-with: lines and replaces Co-authored-by: trailers naming Claude, Cursor, or Anthropic with a single Assisted-By: … trailer". Alternatively, make the hook set HAS_AI_TRAILER on Made-with: too.
There was a problem hiding this comment.
Took the wording fix in 1653bf5. Left the hook unchanged — making Made-with: set HAS_AI_TRAILER changes commit-msg behavior and is out of scope for a docs PR; happy to do it as a follow-up if you want Made-with: Cursor commits to get an Assisted-By trailer.
… hook wording
- workflow: add synchronize/reopened triggers so the check reports on
every head SHA (required status checks hang on pushes with no run);
drop the now-wrong 'body does not change on new pushes' comment
- workflow: anchor 🤖 and Made-with to line start so ordinary prose
('Fixes the 🤖 bot labeler', 'home-made-with care') does not trip the
check; tested against footer and prose vectors
- workflow: permissions: {} (no checkout, no actions, no token) to match
security-scans.yml; list Made-with in the error message
- CONTRIBUTING: describe scripts/hooks/commit-msg accurately — it strips
Made-with lines unconditionally and only adds Assisted-By for
Co-authored-by trailers naming Claude, Cursor, or Anthropic
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Summary
PR descriptions had no attribution guard: the default Claude Code vendor footer (the robot-emoji line and its "...with Claude Code" wording) reaches PR bodies, while commits are already rewritten to
Assisted-Bybyscripts/hooks/commit-msg.This PR adds three layers, matching how the commit side is already handled:
Assisted-By: Claude Code) makes the override deterministic for every contributor's session, not just Paolo's global config.Assisted-By: Claude Code)..github/workflows/pr-attribution.yml— CI check that rejects PR bodies containing the prohibited footers. Reads the body from the event payload, so no checkout, no actions, no token (permissions: {}), and it works unchanged for fork PRs. Triggers onopened/edited/reopened/synchronizeso it reports on every head SHA (safe to mark required). Empty PR descriptions pass.Grep logic tested against the footer variants (plain, markdown-link, emoji-only,
Made-with:) and clean/prose bodies (Fixes the 🤖 bot labeler,home-made-with care,Made-without-tests).Known limitation
The with-claude phrases match anywhere in the body, so a description quoting them verbatim (as an earlier draft of this one did — the check correctly failed it) must paraphrase instead. The emoji and
Made-with:patterns are line-anchored, so mentioning them mid-sentence is safe. Only the body is scanned, never the diff, so editing CONTRIBUTING.md or CLAUDE.md text is unaffected.Assisted-By: Claude Code