|
|
@@ -48,7 +48,7 @@ check_contract() {
|
|
|
|
local desc="$1" body="$2" base="$3" head="$4" diagnostic="$5"
|
|
|
|
local desc="$1" body="$2" base="$3" head="$4" diagnostic="$5"
|
|
|
|
local out rc=0
|
|
|
|
local out rc=0
|
|
|
|
out=$(cd "${FIXTURES}" && HEAD_BRANCH="architect/bug-x7k2m9/contract" \
|
|
|
|
out=$(cd "${FIXTURES}" && HEAD_BRANCH="architect/bug-x7k2m9/contract" \
|
|
|
|
PR_TITLE="[bug-x7k2m9] Enforce contract" PR_AUTHOR="architect" \
|
|
|
|
PR_TITLE="[bug-x7k2m9] fix(check): enforce contract" PR_AUTHOR="architect" \
|
|
|
|
PR_BODY="$body" GITEA_SERVER_URL="https://code.test" GITEA_TOKEN="test-token" \
|
|
|
|
PR_BODY="$body" GITEA_SERVER_URL="https://code.test" GITEA_TOKEN="test-token" \
|
|
|
|
GITEA_REPOSITORY="action/check-naming" GITEA_PR_NUMBER=1 PATH="${TEST_BIN}:$PATH" \
|
|
|
|
GITEA_REPOSITORY="action/check-naming" GITEA_PR_NUMBER=1 PATH="${TEST_BIN}:$PATH" \
|
|
|
|
BASE_SHA="$base" HEAD_SHA="$head" bash "$SCRIPT" 2>&1) || rc=$?
|
|
|
|
BASE_SHA="$base" HEAD_SHA="$head" bash "$SCRIPT" 2>&1) || rc=$?
|
|
|
@@ -66,7 +66,7 @@ check_contract_pass() {
|
|
|
|
local desc="$1" body="$2" base="$3" head="$4"
|
|
|
|
local desc="$1" body="$2" base="$3" head="$4"
|
|
|
|
local out rc=0
|
|
|
|
local out rc=0
|
|
|
|
out=$(cd "${FIXTURES}" && HEAD_BRANCH="architect/bug-x7k2m9/contract" \
|
|
|
|
out=$(cd "${FIXTURES}" && HEAD_BRANCH="architect/bug-x7k2m9/contract" \
|
|
|
|
PR_TITLE="[bug-x7k2m9] Enforce contract" PR_AUTHOR="architect" \
|
|
|
|
PR_TITLE="[bug-x7k2m9] fix(check): enforce contract" PR_AUTHOR="architect" \
|
|
|
|
PR_BODY="$body" GITEA_SERVER_URL="https://code.test" GITEA_TOKEN="test-token" \
|
|
|
|
PR_BODY="$body" GITEA_SERVER_URL="https://code.test" GITEA_TOKEN="test-token" \
|
|
|
|
GITEA_REPOSITORY="action/check-naming" GITEA_PR_NUMBER=1 PATH="${TEST_BIN}:$PATH" \
|
|
|
|
GITEA_REPOSITORY="action/check-naming" GITEA_PR_NUMBER=1 PATH="${TEST_BIN}:$PATH" \
|
|
|
|
BASE_SHA="$base" HEAD_SHA="$head" bash "$SCRIPT" 2>&1) || rc=$?
|
|
|
|
BASE_SHA="$base" HEAD_SHA="$head" bash "$SCRIPT" 2>&1) || rc=$?
|
|
|
@@ -103,13 +103,13 @@ check "dfritz exempt — invalid branch" 0 "totally/wrong-branch" "no prefix"
|
|
|
|
check "dfritz exempt — mismatch" 0 "dev/bug-abc/thing" "[bug-xyz] Thing" "dfritz"
|
|
|
|
check "dfritz exempt — mismatch" 0 "dev/bug-abc/thing" "[bug-xyz] Thing" "dfritz"
|
|
|
|
|
|
|
|
|
|
|
|
# valid role/bug — all roster handles
|
|
|
|
# valid role/bug — all roster handles
|
|
|
|
check "dev/bug matching title" 0 "dev/bug-x7k2m9/fix-terminal-resize" "[bug-x7k2m9] Fix terminal resize" "dev"
|
|
|
|
check "dev/bug matching title" 0 "dev/bug-x7k2m9/fix-terminal-resize" "[bug-x7k2m9] fix(terminal): preserve resize" "dev"
|
|
|
|
check "architect/bug matching title" 0 "architect/bug-abc123/refactor-auth" "[bug-abc123] Refactor auth" "architect"
|
|
|
|
check "architect/bug matching title" 0 "architect/bug-abc123/refactor-auth" "[bug-abc123] refactor(auth): simplify boundary" "architect"
|
|
|
|
check "ops/bug matching title" 0 "ops/bug-zz9/deploy-tweak" "[bug-zz9] Deploy tweak" "ops"
|
|
|
|
check "ops/bug matching title" 0 "ops/bug-zz9/deploy-tweak" "[bug-zz9] fix(delivery): preserve rollout" "ops"
|
|
|
|
check "security/bug matching title" 0 "security/bug-s1a2/patch-cve" "[bug-s1a2] Patch CVE" "security"
|
|
|
|
check "security/bug matching title" 0 "security/bug-s1a2/patch-cve" "[bug-s1a2] fix(auth): close bypass" "security"
|
|
|
|
check "perf/bug matching title" 0 "perf/bug-p0p0/reduce-latency" "[bug-p0p0] Reduce latency" "perf"
|
|
|
|
check "perf/bug matching title" 0 "perf/bug-p0p0/reduce-latency" "[bug-p0p0] perf(checker): reduce latency" "perf"
|
|
|
|
check "ux/bug matching title" 0 "ux/bug-u1u1/polish-modal" "[bug-u1u1] Polish modal" "ux"
|
|
|
|
check "ux/bug matching title" 0 "ux/bug-u1u1/polish-modal" "[bug-u1u1] fix(modal): preserve focus" "ux"
|
|
|
|
check "support/bug matching title" 0 "support/bug-sup9/clarify-error" "[bug-sup9] Clarify error" "support"
|
|
|
|
check "support/bug matching title" 0 "support/bug-sup9/clarify-error" "[bug-sup9] docs(error): clarify recovery" "support"
|
|
|
|
|
|
|
|
|
|
|
|
# valid chore form
|
|
|
|
# valid chore form
|
|
|
|
check "chore — no title prefix" 0 "chore/bump-deps" "Bump dependency versions" "dev"
|
|
|
|
check "chore — no title prefix" 0 "chore/bump-deps" "Bump dependency versions" "dev"
|
|
|
@@ -124,6 +124,9 @@ check "bug-id mismatch" 1 "dev/bug-x7k2m9/fix-resize" "[bug-
|
|
|
|
# fail: 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"
|
|
|
|
check "chore with bug-id title" 1 "chore/bump-deps" "[bug-abc123] Bump deps" "dev"
|
|
|
|
check "role/bug Conventional title" 0 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix(hub): fix resize" "dev"
|
|
|
|
check "role/bug Conventional title" 0 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix(hub): fix resize" "dev"
|
|
|
|
|
|
|
|
check "role/bug plain title" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] Fix resize" "dev"
|
|
|
|
|
|
|
|
check "role/bug missing scope" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix: fix resize" "dev"
|
|
|
|
|
|
|
|
check "role/bug path scope" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix(hub/bugs): fix resize" "dev"
|
|
|
|
check "chore Conventional title" 0 "chore/bump-deps" "chore(deps): bump deps" "dev"
|
|
|
|
check "chore Conventional title" 0 "chore/bump-deps" "chore(deps): bump deps" "dev"
|
|
|
|
|
|
|
|
|
|
|
|
# fail: invalid branch forms
|
|
|
|
# fail: invalid branch forms
|
|
|
@@ -214,7 +217,7 @@ canonical_body bug-x7k2m9 >> "${LARGE_BODY}"
|
|
|
|
large_out=""
|
|
|
|
large_out=""
|
|
|
|
large_rc=0
|
|
|
|
large_rc=0
|
|
|
|
large_out=$(cd "${FIXTURES}" && HEAD_BRANCH="architect/bug-x7k2m9/contract" \
|
|
|
|
large_out=$(cd "${FIXTURES}" && HEAD_BRANCH="architect/bug-x7k2m9/contract" \
|
|
|
|
PR_TITLE="[bug-x7k2m9] Enforce contract" PR_AUTHOR="architect" \
|
|
|
|
PR_TITLE="[bug-x7k2m9] fix(check): enforce contract" PR_AUTHOR="architect" \
|
|
|
|
TEST_PR_BODY_FILE="${LARGE_BODY}" GITEA_SERVER_URL="https://code.test" GITEA_TOKEN="test-token" \
|
|
|
|
TEST_PR_BODY_FILE="${LARGE_BODY}" GITEA_SERVER_URL="https://code.test" GITEA_TOKEN="test-token" \
|
|
|
|
GITEA_REPOSITORY="action/check-naming" GITEA_PR_NUMBER=1 PATH="${TEST_BIN}:$PATH" \
|
|
|
|
GITEA_REPOSITORY="action/check-naming" GITEA_PR_NUMBER=1 PATH="${TEST_BIN}:$PATH" \
|
|
|
|
BASE_SHA="$BASE" HEAD_SHA="$GOOD_HEAD" bash "$SCRIPT" 2>&1) || large_rc=$?
|
|
|
|
BASE_SHA="$BASE" HEAD_SHA="$GOOD_HEAD" bash "$SCRIPT" 2>&1) || large_rc=$?
|
|
|
|
Behavior item 2 still says Bug-backed titles only need the
[bug-id]prefix, while this head rejects that documented form. Update it to require[bug-id] type(scope): descriptionand state whether!is supported; otherwise this required gate blocks compliant-looking PRs.You consult Behavior after this new example, but lines 76–78 still say only the
[bug-id]prefix is required. Define the mandatory lowercase type, one-component scope, optional!, and non-empty description there; the explicit contract currently sends authors to a title CI rejects.This example changes, but Behavior item 2 still promises that
[bug-id]alone is valid. Update that operator contract to require the scoped Conventional Commit form and document optional!; otherwise a documented-valid title fails the required job.