-
Notifications
You must be signed in to change notification settings - Fork 1
chore: public surface cleaning, add commit-msg guard #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+240
−169
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: no-ai-trailers | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [dev, main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: scan PR commits for AI provenance leaks | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Reject AI-tooling tells in commit messages | ||
| env: | ||
| BASE: ${{ github.event.pull_request.base.sha }} | ||
| HEAD: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| set -eu | ||
|
|
||
| patterns=( | ||
| 'Co-Authored-By: Claude' | ||
| 'co-authored-by: claude' | ||
| 'claude\.ai/code/session_' | ||
| 'noreply@anthropic\.com' | ||
| 'Generated with \[Claude Code\]' | ||
| '🤖 Generated with' | ||
| ) | ||
|
|
||
| range="$BASE..$HEAD" | ||
| violators=$( | ||
| git log --format='%H%n%B%n--END--' "$range" \ | ||
| | awk -v RS='--END--\n' 'NF { print $0 }' | ||
| ) | ||
|
|
||
| fail=0 | ||
| while IFS= read -r sha; do | ||
| [ -z "$sha" ] && continue | ||
| body=$(git log -1 --format='%B' "$sha") | ||
| for p in "${patterns[@]}"; do | ||
| if printf '%s' "$body" | grep -qE "$p"; then | ||
| echo "::error::commit $sha leaks AI provenance — matches: $p" | ||
|
joshuaboys marked this conversation as resolved.
|
||
| fail=1 | ||
| fi | ||
| done | ||
| done < <(git log --format='%H' "$range") | ||
|
|
||
| if [ "$fail" -ne 0 ]; then | ||
| echo "::error::Reword the offending commits before merging." | ||
| exit 1 | ||
| fi | ||
| echo "no AI provenance leaks found in $(git rev-list --count "$range") commits" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/usr/bin/env bash | ||
| # Block commit messages that leak AI-tooling provenance. | ||
| # | ||
| # Rejects: | ||
| # - "Co-Authored-By: Claude*" (Claude Code's default trailer) | ||
| # - claude.ai/code/session_* URLs (Claude Code session links) | ||
| # - [email protected] authorship references | ||
| # - "Generated with Claude Code" / "🤖 Generated with" footers | ||
| # | ||
| # Override: COMMIT_ALLOW_AI_TRAILERS=1 git commit ... (use only when intentional). | ||
|
|
||
| set -eu | ||
|
|
||
| msg_file="$1" | ||
|
|
||
| if [ "${COMMIT_ALLOW_AI_TRAILERS:-0}" = "1" ]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Strip standard comment lines so we only inspect actual message content. | ||
| content=$(grep -v '^#' "$msg_file" || true) | ||
|
|
||
| found="" | ||
| case "$content" in | ||
| *"Co-Authored-By: Claude"*) found="Co-Authored-By: Claude trailer" ;; | ||
| *"co-authored-by: claude"*) found="co-authored-by: claude trailer" ;; | ||
| *"claude.ai/code/session_"*) found="claude.ai/code/session_* URL" ;; | ||
| *"[email protected]"*) found="[email protected] reference" ;; | ||
| *"Generated with [Claude Code]"*) found="Generated with [Claude Code] footer" ;; | ||
| *"🤖 Generated with"*) found="🤖 Generated with footer" ;; | ||
|
joshuaboys marked this conversation as resolved.
Outdated
|
||
| esac | ||
|
|
||
| if [ -n "$found" ]; then | ||
| echo "✖ commit-msg blocked: message contains $found." >&2 | ||
| echo " Remove the line, or set COMMIT_ALLOW_AI_TRAILERS=1 if this is intentional." >&2 | ||
| exit 1 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # .mailmap — display-name normalisation for git log / GitHub. | ||
| # | ||
| # Maps inconsistent author names to a canonical display name without | ||
| # rewriting history. Format: <canonical name> <commit email> <commit name> <commit email>. | ||
|
joshuaboys marked this conversation as resolved.
Outdated
|
||
| # See `git help mailmap`. | ||
|
|
||
| Josh Boys <[email protected]> aneki <[email protected]> | ||
| Josh Boys <[email protected]> aneki <[email protected]> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.