-
Notifications
You must be signed in to change notification settings - Fork 136
CI: block AI commits #3973
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
CI: block AI commits #3973
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||||||||||
| name: Block AI Commits | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| pull_request: | ||||||||||||||
| types: [opened, reopened, synchronize] | ||||||||||||||
|
|
||||||||||||||
| concurrency: | ||||||||||||||
| group: block-ai-commits-${{ github.event.pull_request.number }} | ||||||||||||||
| cancel-in-progress: true | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| check-ai-authorship: | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| permissions: | ||||||||||||||
| contents: read | ||||||||||||||
| pull-requests: read | ||||||||||||||
| steps: | ||||||||||||||
| - name: Checkout repository | ||||||||||||||
| uses: actions/checkout@v6 | ||||||||||||||
| with: | ||||||||||||||
| fetch-depth: 0 | ||||||||||||||
|
|
||||||||||||||
| - name: Check commits for AI authorship | ||||||||||||||
| env: | ||||||||||||||
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||||||||||||||
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||||||||||||||
| run: | | ||||||||||||||
| set -euo pipefail | ||||||||||||||
|
|
||||||||||||||
| # Exact AI-tool identities against commit author/committer emails and against Co-authored-by trailers. | ||||||||||||||
| signatures=( | ||||||||||||||
| 'cursoragent@cursor\.com' # Cursor | ||||||||||||||
| 'cursoragent@users\.noreply\.github\.com' # Cursor | ||||||||||||||
| 'noreply@anthropic\.com' # Claude Code | ||||||||||||||
| 'claude-code@anthropic\.com' # Claude Code | ||||||||||||||
| 'noreply@openai\.com' # OpenAI Codex / ChatGPT Codex | ||||||||||||||
| 'codex@openai\.com' # OpenAI Codex / ChatGPT Codex | ||||||||||||||
| 'copilot@github\.com' # GitHub Copilot | ||||||||||||||
| ) | ||||||||||||||
| pattern="$(IFS='|'; echo "${signatures[*]}")" | ||||||||||||||
|
|
||||||||||||||
| if git log --no-merges \ | ||||||||||||||
| --format='%h %ae %ce %(trailers:key=Co-authored-by,valueonly,unfold)' \ | ||||||||||||||
| "${BASE_SHA}..${HEAD_SHA}" | grep -iE "$pattern"; then | ||||||||||||||
|
Comment on lines
+42
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 suggestion (security): Avoid leaking matching email addresses in logs by using grep -q The current
Suggested change
|
||||||||||||||
| echo "::error::This pull request contains commits authored or co-authored by AI tools." | ||||||||||||||
| exit 1 | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| echo "No AI-authored or AI-co-authored commits found." | ||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.