Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/agent-credit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: agent-credit

# Claude and Codex are never credited in a commit or a pull request (AGENTS.md). Apart from ci, so
# that editing a pull request's description checks it again without typechecking, testing and
# building once more.
on:
pull_request:
types: [opened, synchronize, reopened, edited]

jobs:
no-agent-credit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# A squash merge carries every commit's message into main, trailers and all, so each commit
# of the pull request is checked, and the description, which people read on GitHub.
- shell: bash
env:
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
BODY: ${{ github.event.pull_request.body }}
run: |
pattern='co-authored-by:.*(claude|anthropic|codex|openai)|generated (with|by) .*(claude|codex)|@anthropic\.com|@openai\.com'
found=0
for sha in $(git rev-list "$BASE..$HEAD"); do
lines=$(git log -1 --format='Author: %an <%ae>%nCommitter: %cn <%ce>%n%B' "$sha" | grep -iE "$pattern" || true)
if [[ -z "$lines" ]]; then
continue
fi
found=1
echo "::error::$(git log -1 --format='%h %s' "$sha") credits an agent:"
echo "$lines" | sed 's/^/ /'
echo "Reword it without the credit, then force-push."
done
lines=$(printf '%s\n' "$BODY" | grep -iE "$pattern" || true)
if [[ -n "$lines" ]]; then
found=1
echo "::error::The pull request's description credits an agent:"
echo "$lines" | sed 's/^/ /'
echo "Edit the description without the credit; the check runs again on the edit."
fi
if [[ "$found" == 1 ]]; then
exit 1
fi
echo "Neither a commit nor the description credits an agent."
31 changes: 0 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,3 @@ jobs:
- run: bun run typecheck
- run: bun run test
- run: bun run build

# Claude and Codex are never credited in a commit (AGENTS.md). A squash merge carries every
# commit's message into main, trailers and all, so each commit of the pull request is checked.
no-agent-credit:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- shell: bash
env:
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
run: |
pattern='co-authored-by:.*(claude|anthropic|codex|openai)|generated (with|by) .*(claude|codex)|@anthropic\.com|@openai\.com'
found=0
for sha in $(git rev-list "$BASE..$HEAD"); do
lines=$(git log -1 --format='Author: %an <%ae>%nCommitter: %cn <%ce>%n%B' "$sha" | grep -iE "$pattern" || true)
if [[ -z "$lines" ]]; then
continue
fi
found=1
echo "::error::$(git log -1 --format='%h %s' "$sha") credits an agent:"
echo "$lines" | sed 's/^/ /'
done
if [[ "$found" == 1 ]]; then
echo "Reword these commits without the credit, then force-push."
exit 1
fi
echo "No commit credits an agent."
Loading