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
+13 -12
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# Branch and PR title naming-standard checker.
# Always exits 0 — warn-only until the Bugs system is live and STRICT=1 is set.
# 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
BRANCH="${HEAD_BRANCH:-}"
@@ -13,7 +14,7 @@ if [ "${AUTHOR}" = "dfritz" ]; then
exit 0
fi
WARN=0
FAILED=0
BRANCH_KIND="invalid"
BRANCH_BUG=""
@@ -26,10 +27,10 @@ if echo "${BRANCH}" | grep -qE "^(dev|ux|ops|security|perf|architect|support)/bu
elif echo "${BRANCH}" | grep -qE "^chore/[a-z0-9][a-z0-9-]*$"; then
BRANCH_KIND="chore"
else
echo "WARN[check-naming]: branch '${BRANCH}' does not match convention"
echo "FAIL[check-naming]: branch '${BRANCH}' does not match convention"
echo " expected: <role>/bug-<id>/<kebab> (role: dev|ux|ops|security|perf|architect|support)"
echo " or: chore/<kebab>"
WARN=1
FAILED=1
fi
# ---- title form ----
@@ -40,19 +41,19 @@ fi
if [ "${BRANCH_KIND}" = "role-bug" ]; then
if [ -z "${TITLE_BUG}" ]; then
echo "WARN[check-naming]: title missing [${BRANCH_BUG}] prefix for branch '${BRANCH}'"
WARN=1
echo "FAIL[check-naming]: title missing [${BRANCH_BUG}] prefix for branch '${BRANCH}'"
FAILED=1
elif [ "${TITLE_BUG}" != "${BRANCH_BUG}" ]; then
echo "WARN[check-naming]: bug-id mismatch — branch carries '${BRANCH_BUG}' but title carries '${TITLE_BUG}'"
WARN=1
echo "FAIL[check-naming]: bug-id mismatch — branch carries '${BRANCH_BUG}' but title carries '${TITLE_BUG}'"
FAILED=1
fi
elif [ "${BRANCH_KIND}" = "chore" ] && [ -n "${TITLE_BUG}" ]; then
echo "WARN[check-naming]: chore branch should not carry a [bug-id] title prefix"
WARN=1
echo "FAIL[check-naming]: chore branch should not carry a [bug-id] title prefix"
FAILED=1
fi
if [ "${WARN}" -eq 0 ]; then
if [ "${FAILED}" -eq 0 ]; then
echo "check-naming: ok"
fi
exit 0
exit "${FAILED}"