Skip to content

Adopt shared Scala CI workflow #13

Adopt shared Scala CI workflow

Adopt shared Scala CI workflow #13

name: AI Policy Check
on:
pull_request:
types: [opened, synchronize, reopened]
merge_group:
types: [checks_requested]
permissions:
contents: read
jobs:
no-ai-attribution:
name: AI Policy Check
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Check commit attribution
uses: commit-check/commit-check-action@d109324148a73dc758891d1d85924c912dbfd38b # v2.12.0
env:
CCHK_AI_ATTRIBUTION: "forbid"
CCHK_CONVENTIONAL_COMMITS: "false"
CCHK_SUBJECT_MAX_LENGTH: "150"
CCHK_SUBJECT_CAPITALIZED: "false"
CCHK_SUBJECT_IMPERATIVE: "false"
CCHK_ALLOW_EMPTY_COMMITS: "true"
CCHK_ALLOW_WIP_COMMITS: "true"
CCHK_REQUIRE_BODY: "false"
CCHK_REQUIRE_SIGNED_OFF_BY: "false"
with:
message: true
branch: false
author-name: false
author-email: false
pr-title: false
job-summary: true
pr-comments: false
# commit-check 2.12.2 now detects space-separated model names such as
# "Claude Fable 5 (1M context)", but only for claude/gpt/gemini in
# Co-authored-by. Keep covering Assisted-by and the other tool names.
- name: Check AI attribution in trailers (supplemental)
shell: bash
run: |
if [ "$GITHUB_EVENT_NAME" = "merge_group" ]; then
BASE="${{ github.event.merge_group.base_sha }}"
HEAD="${{ github.event.merge_group.head_sha }}"
else
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
fi
PATTERN='^(co-authored-by|assisted-by):(.*<[^>]*noreply@anthropic\.com[^>]*>.*|[^<]*\b(claude|gpt|gemini|copilot|codex|cursor|aider|devin|windsurf|tabby)\b[^<]*[0-9].*)$'
FAILED=0
for sha in $(git rev-list "$BASE..$HEAD"); do
if git log -1 --format=%B "$sha" | grep -qiE "$PATTERN"; then
echo "::error::Commit $sha contains forbidden AI attribution:"
git log -1 --format=%B "$sha" | grep -iE "$PATTERN"
FAILED=1
fi
done
if [ "$FAILED" -ne 0 ]; then
echo "AI tools must not be listed as commit authors or co-authors." \
"Remove the trailer (rebase/amend) and force-push." \
"See https://github.com/evolution-gaming/.github/blob/main/AI_POLICY.md"
exit 1
fi
- name: Link AI policy on failure
if: failure()
shell: bash
run: |
POLICY="https://github.com/evolution-gaming/.github/blob/main/AI_POLICY.md"
echo "::error::AI tools must not be listed as commit authors or co-authors. Remove the trailer (rebase/amend, then force-push). AI Contribution Policy: $POLICY"
{
echo ""
echo "## ❌ AI Contribution Policy"
echo ""
echo "AI tools may assist with development, but they must not be listed as commit"
echo "authors or co-authors — a human author takes responsibility for every commit."
echo ""
echo "**Fix:** remove the AI trailer from the flagged commits (\`git rebase -i\` /"
echo "\`git commit --amend\`) and force-push the branch."
echo ""
echo "📄 [Read the full AI Contribution Policy]($POLICY)"
} >> "$GITHUB_STEP_SUMMARY"