Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clerk/legacy/clerk.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3102,7 +3102,7 @@ finish_reconcile_unit() { # $1=backend $2=root $3=id-or-empty $4=watch(0|1) $5=s
fi
pending=$(finish_check_pending "$pr_json")
if [ -n "$pending" ]; then
printf "clerk: PR #%s for %s has pending checks — rerun 'clerk backlog finish' when green (or use --watch)\n" "$pr_number" "$full"
printf "clerk: PR #%s for %s has pending checks — run 'clerk backlog finish %s --watch' to wait\n" "$pr_number" "$full" "$full"
while IFS= read -r line || [ -n "$line" ]; do
[ -n "$line" ] || continue
printf ' %s\n' "$line"
Expand Down
14 changes: 14 additions & 0 deletions tests/clerk/finish-sync.bats
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ if [ "$1 $2" = "pr list" ]; then
case "$mode" in
none) json='[]' ;;
review) json='[{"number":7,"url":"https://example/pr/7","state":"OPEN","mergedAt":"","reviewDecision":"REVIEW_REQUIRED","statusCheckRollup":[{"name":"delivery-gate","status":"COMPLETED","conclusion":"SUCCESS"}],"headRefName":"delivery/x","isDraft":false,"updatedAt":"2026-07-10T00:00:00Z"}]' ;;
pending) json='[{"number":6,"url":"https://example/pr/6","state":"OPEN","mergedAt":"","reviewDecision":"APPROVED","statusCheckRollup":[{"name":"delivery-gate","status":"IN_PROGRESS","conclusion":""}],"headRefName":"delivery/x","isDraft":false,"updatedAt":"2026-07-10T00:00:00Z"}]' ;;
fail) json='[{"number":8,"url":"https://example/pr/8","state":"OPEN","mergedAt":"","reviewDecision":"APPROVED","statusCheckRollup":[{"name":"delivery-gate","status":"COMPLETED","conclusion":"FAILURE"},{"name":"unit-tests","status":"COMPLETED","conclusion":"SUCCESS"}],"headRefName":"delivery/x","isDraft":false,"updatedAt":"2026-07-10T00:00:00Z"}]' ;;
merged) json='[{"number":9,"url":"https://example/pr/9","state":"MERGED","mergedAt":"2026-07-10T00:00:00Z","reviewDecision":"APPROVED","statusCheckRollup":[{"name":"delivery-gate","status":"COMPLETED","conclusion":"SUCCESS"}],"headRefName":"delivery/x","isDraft":false,"updatedAt":"2026-07-10T00:00:00Z"}]' ;;
multi) json='[{"number":5,"url":"https://example/pr/5","state":"CLOSED","mergedAt":"","reviewDecision":"","statusCheckRollup":[],"headRefName":"delivery/x","isDraft":false,"updatedAt":"2026-07-09T00:00:00Z"},{"number":12,"url":"https://example/pr/12","state":"OPEN","mergedAt":"","reviewDecision":"REVIEW_REQUIRED","statusCheckRollup":[{"name":"delivery-gate","status":"COMPLETED","conclusion":"SUCCESS"}],"headRefName":"delivery/x","isDraft":false,"updatedAt":"2026-07-10T00:00:00Z"}]' ;;
Expand Down Expand Up @@ -125,6 +126,19 @@ SH
! grep -q 'pr merge' "$BATS_TEST_TMPDIR/gh.calls"
}

@test "finish: pending checks prescribe --watch and exit successfully" {
repo=$(make_finish_repo finish_pending)
cd "$repo"
id=$(mk_claimed_unit)
short="${id#*-}"
git checkout -q "delivery/$short"
install_gh_pr_stub pending
run "$CLERK" backlog finish
[ "$status" -eq 0 ]
[ "${lines[0]}" = "clerk: PR #6 for $id has pending checks — run 'clerk backlog finish $id --watch' to wait" ]
[ "${lines[1]}" = " delivery-gate" ]
}

@test "finish: failing checks output each named failure" {
repo=$(make_finish_repo finish_fail)
cd "$repo"
Expand Down
Loading