From d4eaaafb402d208b8c9be4c10043ae0f3a8c5145 Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Tue, 13 Oct 2026 09:40:49 +0900 Subject: [PATCH] ci: reject coding tool attributions in PRs --- .github/workflows/commit-check.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/commit-check.yml diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml new file mode 100644 index 0000000000..765523d22b --- /dev/null +++ b/.github/workflows/commit-check.yml @@ -0,0 +1,34 @@ +name: Commit check + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + no-tool-attribution: + # Reject coding tool attributions in commit messages and the PR description. + runs-on: ubuntu-slim + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Check commit messages and PR description + env: + BASE_REF: ${{ github.base_ref }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_BODY: ${{ github.event.pull_request.body }} + run: | + pattern='noreply@anthropic\.com|co-authored-by:.*(claude|copilot|cursor|codex|gemini|aider)|generated (with|by) .*(claude|copilot|cursor|chatgpt|codex|gemini)' + { + git log --format=%B "origin/$BASE_REF..HEAD" + printf '%s\n%s\n' "$PR_TITLE" "$PR_BODY" + } > "$RUNNER_TEMP/messages.txt" + if grep -inE "$pattern" "$RUNNER_TEMP/messages.txt"; then + echo "::error::Remove coding tool attribution from the commit messages and PR description." + exit 1 + fi