@futurelastic/colab-handbook 1.12.0-rc.39 → 1.12.0-rc.40

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 CHANGED
@@ -27,5 +27,5 @@
27
27
  "engines": {
28
28
  "node": ">=18"
29
29
  },
30
- "version": "1.12.0-rc.39"
30
+ "version": "1.12.0-rc.40"
31
31
  }
@@ -198,6 +198,9 @@ env:
198
198
  # next the newest candidate (vX.Y.Z-rc.N) — the fast channel
199
199
  # vX.Y.Z an exact version tag — frozen; moving it is a deliberate act, like re-copying
200
200
  # a template
201
+ # A ref the handbook does not carry (e.g. `stable` before its first final, or on a mirror)
202
+ # falls back to the newest final tag new enough for this template, else `next`, with a warning —
203
+ # it never fails the run (#480).
201
204
  HANDBOOK_REF: "stable"
202
205
  HANDBOOK_REPO: "https://github.com/futurelastic/colab-handbook.git"
203
206
  # A TRANSIENT UPSTREAM ERROR NEVER TURNS MAIN RED (#464). This run fires on every landing, and a
@@ -306,6 +309,23 @@ jobs:
306
309
  run: |
307
310
  set -euo pipefail
308
311
  eval "$RETRY_TRANSIENT"
312
+ # A HANDBOOK_REF the handbook does not carry falls back instead of failing (#480): `stable`
313
+ # exists only once a final has been cut, and a fork or mirror may never have it. The
314
+ # fallback is the newest final vX.Y.Z tag at or above MIN_FINAL, else `next`, and it says
315
+ # so. MIN_FINAL is the first final carrying every CLI verb this template calls (`--auto`,
316
+ # #422–#425): an older final rejects them, and that is a red run too (#427). A ref that
317
+ # does exist is always used as written; a failed listing fails the step, never guesses.
318
+ MIN_FINAL="v1.12.0"
319
+ REFS="$(retry_transient git ls-remote --heads --tags "$HANDBOOK_REPO")"
320
+ if ! grep -Eq "[[:space:]]refs/(heads|tags)/${HANDBOOK_REF//./\\.}$" <<< "$REFS"; then
321
+ FALLBACK="next"
322
+ for t in $(sed -nE 's#^[0-9a-f]+[[:space:]]+refs/tags/(v[0-9]+\.[0-9]+\.[0-9]+)$#\1#p' <<< "$REFS" | sort -V); do
323
+ [ "$(printf '%s\n' "$MIN_FINAL" "$t" | sort -V | head -n 1)" = "$MIN_FINAL" ] && FALLBACK="$t"
324
+ done
325
+ echo "::warning::HANDBOOK_REF \"$HANDBOOK_REF\" is not a branch or tag of $HANDBOOK_REPO — using \"$FALLBACK\" (the newest final tag from $MIN_FINAL on, else next). Set HANDBOOK_REF to silence this."
326
+ echo "HANDBOOK_REF \`$HANDBOOK_REF\` does not exist upstream — fetched \`$FALLBACK\` instead (#480)." >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
327
+ HANDBOOK_REF="$FALLBACK"
328
+ fi
309
329
  # A clone that died half-way leaves a directory a second clone refuses — start clean each try.
310
330
  fetch_cli() { rm -rf "$RUNNER_TEMP/colab-handbook"; git clone --quiet --depth 1 --branch "$HANDBOOK_REF" "$HANDBOOK_REPO" "$RUNNER_TEMP/colab-handbook"; }
311
331
  retry_transient fetch_cli