Skip to content

Commit 4b876f3

Browse files
committed
ci: add PR commit message sanity check workflow
Adds a GitHub Actions workflow that scans every commit in a pull request and fails if any commit message carries a Co-authored-by or Signed-off-by trailer pointing at noreply@anthropic.com.
1 parent b573823 commit 4b876f3

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: PR commit message checks
2+
3+
on:
4+
pull_request:
5+
branches: [ '*' ]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
# END OF COMMON SECTION
11+
12+
jobs:
13+
commit-messages:
14+
if: github.repository_owner == 'wolfssl'
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Reject AI attribution trailers
22+
env:
23+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
24+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
25+
run: |
26+
set -euo pipefail
27+
fail=0
28+
while IFS= read -r sha; do
29+
[ -z "$sha" ] && continue
30+
if git log -1 --format=%B "$sha" | \
31+
grep -iE '^(Co-authored-by|Signed-off-by):.*<?noreply@anthropic\.com>?' >/dev/null; then
32+
echo "::error::Commit $sha contains a Co-authored-by or Signed-off-by trailer for noreply@anthropic.com"
33+
git log -1 --format=' %h %s' "$sha"
34+
fail=1
35+
fi
36+
done < <(git rev-list "$BASE_SHA".."$HEAD_SHA")
37+
if [ "$fail" -ne 0 ]; then
38+
echo "One or more commits contain disallowed AI attribution trailers; please amend them out."
39+
exit 1
40+
fi
41+
echo "No disallowed AI attribution trailers found."

0 commit comments

Comments
 (0)