v2: fail (exit 1) on naming violation
test / test (pull_request) Successful in 4s

The four wired repos flip the naming job to a required status check
(agenthub#557 WS6); a check that always exits 0 can never gate. v2 makes
the script exit nonzero with FAIL lines; warn-only stays available via
job-level continue-on-error or the legacy @v1 tag. dfritz break-glass
exemption unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 18:05:26 +00:00
co-authored by Claude Fable 5
parent 5b5d16c46f
commit 9bfbd24461
4 changed files with 44 additions and 40 deletions
+9 -15
View File
@@ -7,22 +7,16 @@ PASS=0
FAIL=0
check() {
local desc="$1" want_warn="$2" branch="$3" title="$4" author="$5"
local desc="$1" want_fail="$2" branch="$3" title="$4" author="$5"
local out rc=0
out=$(HEAD_BRANCH="$branch" PR_TITLE="$title" PR_AUTHOR="$author" bash "$SCRIPT" 2>&1) || rc=$?
if [ "$rc" -ne 0 ]; then
echo "FAIL [$desc]: script exited $rc (must always exit 0)"
echo " output: $out"
FAIL=$((FAIL + 1))
return
fi
local got_warn=0
echo "$out" | grep -qE "^WARN" && got_warn=1 || true
if [ "$got_warn" -eq "$want_warn" ]; then
local got_lines=0
echo "$out" | grep -qE "^FAIL" && got_lines=1 || true
if [ "$rc" -eq "$want_fail" ] && [ "$got_lines" -eq "$want_fail" ]; then
echo "PASS [$desc]"
PASS=$((PASS + 1))
else
echo "FAIL [$desc]: expected warn=$want_warn got=$got_warn"
echo "FAIL [$desc]: expected exit=$want_fail fail-lines=$want_fail, got exit=$rc fail-lines=$got_lines"
echo " output: $out"
FAIL=$((FAIL + 1))
fi
@@ -45,16 +39,16 @@ check "support/bug matching title" 0 "support/bug-sup9/clarify-error"
check "chore — no title prefix" 0 "chore/bump-deps" "Bump dependency versions" "dev"
check "chore — plain title" 0 "chore/fix-a-typo" "Fix typo in README" "ops"
# warn: role/bug branch but no [bug-id] title prefix
# fail: role/bug branch but no [bug-id] title prefix
check "role/bug no title prefix" 1 "dev/bug-x7k2m9/fix-resize" "Fix resize" "dev"
# warn: bug-id mismatch between branch and title
# fail: bug-id mismatch between branch and title
check "bug-id mismatch" 1 "dev/bug-x7k2m9/fix-resize" "[bug-zzzzz1] Fix resize" "dev"
# warn: chore branch with [bug-id] title prefix
# fail: chore branch with [bug-id] title prefix
check "chore with bug-id title" 1 "chore/bump-deps" "[bug-abc123] Bump deps" "dev"
# warn: invalid branch forms
# fail: invalid branch forms
check "invalid — no role prefix" 1 "feature/foo-bar" "Add feature" "dev"
check "invalid — missing bug segment" 1 "dev/fix-something" "Fix something" "dev"
check "invalid — unknown role" 1 "unknown/bug-abc/thing" "[bug-abc] Thing" "dev"