@biffo/cli 0.253.3 → 0.253.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/wait-for-checks.sh +28 -2
package/package.json
CHANGED
|
@@ -37,6 +37,27 @@
|
|
|
37
37
|
# same count seen on two consecutive polls — so a fast check concluding while
|
|
38
38
|
# slower ones are still registering does not end the wait early.
|
|
39
39
|
#
|
|
40
|
+
# ## A re-run does not replace its old entry, and `statusCheckRollup` never drops it
|
|
41
|
+
#
|
|
42
|
+
# `statusCheckRollup` returns **every** check run against the PR's head commit,
|
|
43
|
+
# including ones a later run has superseded — a re-run adds a second row under
|
|
44
|
+
# the same name rather than replacing the first. Read naively, a check that
|
|
45
|
+
# failed once and was then fixed by a re-run still shows a FAILURE row forever,
|
|
46
|
+
# so "any row with a FAILURE conclusion" reports the wrong thing on exactly the
|
|
47
|
+
# PRs most likely to need this script: anything that failed and was corrected.
|
|
48
|
+
# GitHub's own merge gate, and `gh pr checks`, both resolve a required context to
|
|
49
|
+
# the **latest** run of that name — this script has to do the same, or it
|
|
50
|
+
# disagrees with the authority it exists to reflect (#1333, class #1362).
|
|
51
|
+
#
|
|
52
|
+
# So the rollup is deduped by name, keeping the entry with the latest
|
|
53
|
+
# `completedAt`/`startedAt` (falling back to `updatedAt`/`createdAt` for a plain
|
|
54
|
+
# commit status, which carries no `startedAt`/`completedAt` at all), **before**
|
|
55
|
+
# any conclusion is evaluated. Same `group_by | max_by(latest timestamp)` shape
|
|
56
|
+
# `branch-health.sh` already uses for its per-workflow rollup — that script reads
|
|
57
|
+
# `gh run list`, whose rows are one per distinct run rather than per check name,
|
|
58
|
+
# so it was never exposed to this defect, but the resolution method is the same
|
|
59
|
+
# one worth keeping consistent.
|
|
60
|
+
#
|
|
40
61
|
# ## Exit codes, and why 2 exists
|
|
41
62
|
#
|
|
42
63
|
# 0 every required/observed check concluded, none failed
|
|
@@ -200,9 +221,14 @@ while :; do
|
|
|
200
221
|
rollup=$(gh_pr view "$PR" --json statusCheckRollup --jq '
|
|
201
222
|
[ .statusCheckRollup[]?
|
|
202
223
|
| { name: (.name // .context),
|
|
203
|
-
state: (.conclusion // .state // (if .status == "COMPLETED" then "" else null end))
|
|
224
|
+
state: (.conclusion // .state // (if .status == "COMPLETED" then "" else null end)),
|
|
225
|
+
when: (.completedAt // .startedAt // .updatedAt // .createdAt // "")
|
|
204
226
|
}
|
|
205
|
-
]
|
|
227
|
+
]
|
|
228
|
+
| group_by(.name)
|
|
229
|
+
| map(max_by(.when))
|
|
230
|
+
| .[]
|
|
231
|
+
| "\(.name)\t\(.state // "")"') || rollup=""
|
|
206
232
|
|
|
207
233
|
count=0
|
|
208
234
|
[ -n "$rollup" ] && count=$(printf '%s\n' "$rollup" | grep -c .)
|