@futurelastic/colab-handbook 1.17.1-rc.1 → 1.17.1-rc.2
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/templates/release-auto.yml +44 -2
package/package.json
CHANGED
|
@@ -268,6 +268,46 @@ env:
|
|
|
268
268
|
sleep "$delay"; attempt=$((attempt + 1)); delay=$((delay * 2))
|
|
269
269
|
done
|
|
270
270
|
}
|
|
271
|
+
# THE HEAVY LANE IS DISPATCHED WITH THE INPUTS IT DECLARES (#661). The template's heavy workflow
|
|
272
|
+
# declares a `ref` dispatch input, but you own your copy and may not: `-f ref=` to a workflow
|
|
273
|
+
# without that input is a hard `HTTP 422: Unexpected inputs provided`, and the release never starts
|
|
274
|
+
# its own heavy lane. `heavy_dispatch <tag>` reads the file AT THE TAG (the working tree's copy when
|
|
275
|
+
# the tag cannot be read), lists only its `on: workflow_dispatch: inputs:` keys — a `workflow_call`
|
|
276
|
+
# `ref` does not count — and passes `-f ref=<tag>` only when `ref` is one of them; `--ref <tag>`
|
|
277
|
+
# alone checks out the same commit. The same rule as colab's own hint (workflowDispatchInputs, #660).
|
|
278
|
+
# Steps that use it `eval` this block after RETRY_TRANSIENT and set HEAVY_WORKFLOW.
|
|
279
|
+
HEAVY_DISPATCH: |
|
|
280
|
+
heavy_dispatch_inputs() {
|
|
281
|
+
awk -v sq="'" '
|
|
282
|
+
function ind(l) { match(l, /^[ \t]*/); return RLENGTH }
|
|
283
|
+
function meaningful(l) { return l ~ /[^ \t]/ && l !~ /^[ \t]*#/ }
|
|
284
|
+
BEGIN { on = "^(on|\"on\"|" sq "on" sq ")[ \t]*:[ \t]*(#.*)?$"; st = 0; n = 0 }
|
|
285
|
+
st == 0 { if ($0 ~ on) st = 1; next }
|
|
286
|
+
/^[^ \t]/ { exit }
|
|
287
|
+
st == 1 { if ($0 ~ /^[ \t]*workflow_dispatch[ \t]*:/) { wd = ind($0); st = 2 }; next }
|
|
288
|
+
!meaningful($0) { next }
|
|
289
|
+
st == 2 { if (ind($0) <= wd) exit; if ($0 ~ /^[ \t]*inputs[ \t]*:[ \t]*(#.*)?$/) { ii = ind($0); st = 3 }; next }
|
|
290
|
+
st == 3 { if (ind($0) <= ii) exit; n++; line[n] = $0; next }
|
|
291
|
+
END {
|
|
292
|
+
if (!n) exit
|
|
293
|
+
min = -1
|
|
294
|
+
for (i = 1; i <= n; i++) if (min < 0 || ind(line[i]) < min) min = ind(line[i])
|
|
295
|
+
for (i = 1; i <= n; i++) if (ind(line[i]) == min) {
|
|
296
|
+
k = line[i]; sub(/^[ \t]*/, "", k)
|
|
297
|
+
if (match(k, /^[A-Za-z_][A-Za-z0-9_-]*[ \t]*:/)) { k = substr(k, 1, RLENGTH); sub(/[ \t]*:$/, "", k); print k }
|
|
298
|
+
}
|
|
299
|
+
}'
|
|
300
|
+
}
|
|
301
|
+
heavy_dispatch() {
|
|
302
|
+
local tag="$1" file=".github/workflows/$HEAVY_WORKFLOW" text
|
|
303
|
+
text="$(git show "$tag:$file" 2>/dev/null)" || text="$(cat "$file" 2>/dev/null)" || text=""
|
|
304
|
+
# Unreadable → the template's shape is assumed (colab's takesRefInput reads it the same way).
|
|
305
|
+
if [ -z "$text" ] || printf '%s\n' "$text" | heavy_dispatch_inputs | grep -qx ref; then
|
|
306
|
+
retry_transient gh workflow run "$HEAVY_WORKFLOW" --ref "$tag" -f ref="$tag"
|
|
307
|
+
else
|
|
308
|
+
retry_transient gh workflow run "$HEAVY_WORKFLOW" --ref "$tag"
|
|
309
|
+
fi
|
|
310
|
+
}
|
|
271
311
|
|
|
272
312
|
jobs:
|
|
273
313
|
release:
|
|
@@ -560,9 +600,10 @@ jobs:
|
|
|
560
600
|
run: |
|
|
561
601
|
set -uo pipefail
|
|
562
602
|
eval "$RETRY_TRANSIENT"
|
|
603
|
+
eval "$HEAVY_DISPATCH"
|
|
563
604
|
if [ ! -f ".github/workflows/$HEAVY_WORKFLOW" ]; then
|
|
564
605
|
echo "No .github/workflows/$HEAVY_WORKFLOW — no heavy lane to start."
|
|
565
|
-
elif
|
|
606
|
+
elif heavy_dispatch "$TAG"; then
|
|
566
607
|
echo "Dispatched $HEAVY_WORKFLOW at $TAG — a final needs its green run at this commit." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
567
608
|
else
|
|
568
609
|
echo "::warning::could not dispatch $HEAVY_WORKFLOW at $TAG — the finalize step dispatches it again"
|
|
@@ -581,6 +622,7 @@ jobs:
|
|
|
581
622
|
run: |
|
|
582
623
|
set -uo pipefail
|
|
583
624
|
eval "$RETRY_TRANSIENT"
|
|
625
|
+
eval "$HEAVY_DISPATCH"
|
|
584
626
|
if [ ! -f ".github/workflows/$HEAVY_WORKFLOW" ]; then
|
|
585
627
|
echo "No .github/workflows/$HEAVY_WORKFLOW — no heavy lane gates the final."
|
|
586
628
|
exit 0
|
|
@@ -609,7 +651,7 @@ jobs:
|
|
|
609
651
|
echo "::warning::$TAG not finalized: the heavy lane is red at $SHA ($(jq -r '.[0].url' <<< "$RUNS")) — re-run it green, or cut a new candidate"
|
|
610
652
|
elif [ "${DRY_RUN:-false}" = "true" ]; then
|
|
611
653
|
echo "Dry run — would start $HEAVY_WORKFLOW at $TAG (no run at $SHA yet)." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
612
|
-
elif
|
|
654
|
+
elif heavy_dispatch "$TAG"; then
|
|
613
655
|
echo "No heavy run at $TAG yet — dispatched $HEAVY_WORKFLOW; a later run finalizes on its green." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
614
656
|
else
|
|
615
657
|
echo "::warning::$TAG not finalized: no heavy run at $SHA and $HEAVY_WORKFLOW could not be dispatched"
|