Require authorship only in PR descriptions (#11)
test / test (push) Successful in 9s

Remove commit-message watermark inspection while preserving visible PR attribution, naming, identity exemptions and nonempty commit-range validation.

All79 offline contract cases and shell syntax pass.

Ticket: https://agenthub.fritzlab.net/t-d12vqnp63v5d
This commit was merged in pull request #11.
This commit is contained in:
dfritz committed 2026-10-18 15:48:13 +00:00
1 parent 2f18a5fd5b
commit 1edb148aa1
4 files changed
+66 -32

No files matched your search

+4 -18
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Branch, PR body, and commit contract checker.
# Branch, PR body, and commit-range contract checker.
# v2: exits 1 on violation. Consumers that want warn-only set
# continue-on-error: true on the job (or stay on @v1).
set -euo pipefail
@@ -180,23 +180,9 @@ if [ "${BRANCH_KIND}" != "invalid" ]; then
fi
done
if git cat-file -e "${BASE}^{commit}" 2>/dev/null && git cat-file -e "${HEAD}^{commit}" 2>/dev/null; then
commit_count=0
while IFS= read -r commit; do
[ -n "${commit}" ] || continue
commit_count=$((commit_count + 1))
message=$(git log -1 --format=%B "${commit}")
if ! printf '%s\n' "${message}" | awk '
{ line[NR]=$0 }
END {
n=NR
while (n > 0 && line[n] == "") n--
if (n < 3 || line[n-1] != "" || line[n] !~ /^Authored-By: .+ \(.+\) <noreply@[[:alnum:].-]+>$/) exit 1
}
'; then
echo "FAIL[check-naming]: commit ${commit} must end with an Authored-By product/model trailer"
FAILED=1
fi
done < <(git rev-list --reverse "${BASE}..${HEAD}" 2>/dev/null)
# Attribution belongs only in the PR description, not commit messages.
# Keep the existing nonempty-range gate independently of message content.
commit_count=$(git rev-list --count "${BASE}..${HEAD}" 2>/dev/null) || commit_count=0
if [ "${commit_count}" -eq 0 ]; then
echo "FAIL[check-naming]: base-sha..head-sha contains no PR commits"
FAILED=1