Skip to content

Add a reusable check that blocks AI attribution in pull requests - #4

Merged
ditahkk merged 2 commits into
mainfrom
issues/3-no-ai-attribution-check
Nov 19, 2026
Merged

ditahkk merged 2 commits into
mainfrom
issues/3-no-ai-attribution-check

Conversation

@ditahkk

@ditahkk ditahkk commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Closes #3

What

  • scripts/no-ai-attribution/check.py: one short Python 3 script, standard library only. It reads the PR title, description and every commit (paged through the GitHub API) and fails on lines that credit an AI tool: co-author trailers naming an AI tool or vendor, AI vendor noreply addresses, and the "made with a robot" footers some tools append. The pattern list lives in one place in the script.
  • scripts/no-ai-attribution/test_check.py: blocked and allowed fixtures, including plain mentions of tool names (a CLI config commit, an egress allowlist) that must pass.
  • .github/workflows/no-ai-attribution.yml: reusable workflow_call workflow with contents: read and pull-requests: read. Third-party action pinned to a full SHA.
  • workflow-templates/no-ai-attribution.yml: the caller each repo adds. Check name: no-ai-attribution / check.
  • .github/workflows/ci.yml: runs the tests and the check on this repo's own PRs, using the PR's version of the script.

Why this and not an existing tool

  • Org rulesets, required workflows and push rulesets with commit message patterns all need GitHub Team or Enterprise; gh api orgs/zsoftly reports the Free plan, and the org rulesets API returns "Upgrade to GitHub Team".
  • Marketplace options are either young single-maintainer projects or generic regex checkers last updated in 2024, so a 90-line script we own is the smaller risk.

Dependabot and Renovate

Their PR descriptions quote upstream release notes, so the description is skipped for those two bot accounts. Their commits are still checked.

Test

  • Unit tests pass locally.
  • The commit message from the zs-gitops-apps #588 incident fails the script; current PRs there pass.

One dependency-free Python script reads every commit of a pull request
through the GitHub API, plus the PR title and description, and fails on
co-author trailers or footers that credit an AI tool. The pattern list
lives only in the script and its tests.

Repositories call .github/workflows/no-ai-attribution.yml through the
small caller in workflow-templates/. This repository runs the unit tests
and the check on its own pull requests.

Closes #3

Signed-off-by: ditahkk <ditah.k@zsoftly.com>
@ditahkk ditahkk self-assigned this Nov 19, 2026
Anchor the footer pattern so feature text that mentions AI passes, limit
the trailer match to the name, and add assisted-by trailers and a few
more tools. Flag commits whose author or committer is an AI tool, since
a squash merge turns them into co-author trailers.

Retry transient API errors, skip Renovate and Dependabot app variants,
ignore comments and the diff in local hook mode, exit cleanly outside a
pull request so merge queues work, and run private repos on the shared
self-hosted runners to save hosted minutes.

Signed-off-by: ditahkk <ditah.k@zsoftly.com>
@ditahkk
ditahkk merged commit 30ccf90 into main Nov 19, 2026
2 checks passed
@ditahkk
ditahkk deleted the issues/3-no-ai-attribution-check branch November 19, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Org-wide check that blocks AI attribution in pull requests

1 participant