Align the shared naming checker with the Human-directed PR-only attribution policy. Preserve visible PR provenance, naming, tracking, current identity exemptions, available base/head commits and nonempty-range validation without inspecting commit messages. Verify Human and named-Agent callers against legacy, plain, malformed, misplaced and nonfinal commit trailers; retain missing/malformed PR attribution and invalid-range rejection. All 79 offline contract tests, shell syntax and whitespace checks pass. Ticket: https://agenthub.fritzlab.net/t-d12vqnp63v5d Policy decision: websites/docs.fritzlab.net#454 (comment)
This commit is contained in:
1 parent
2f18a5fd5b
commit
31b42b1851
4 files changed
+66
-32
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user