@biffo/cli 0.296.12 → 0.296.13

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.296.12",
3
+ "version": "0.296.13",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -54,6 +54,18 @@
54
54
  # merges landing seconds apart cancel the first run by design. It is called out
55
55
  # by name so nobody debugs a phantom.
56
56
  #
57
+ # `plan-only` (#1582) is likewise reported but does not fail the branch — a
58
+ # `Deploy Infrastructure` dispatch left at the default `action: plan` really did
59
+ # succeed at planning, and that can be entirely deliberate (an operator running
60
+ # a dry run). What it must never do is share the plain `ok` label a real apply
61
+ # gets: `conclusion` is "success" either way, so the ONLY signal that tells them
62
+ # apart is the run's own title (`displayTitle`), which #1678 made carry a
63
+ # `PLAN ONLY ... (nothing applied)` marker for exactly this. This script fails
64
+ # CLOSED on that signal going missing — see the summary query below, where
65
+ # `displayTitle`'s absence collapses the whole `gh run list` call to empty
66
+ # output, which is already handled as exit 2 ("cannot tell"), not as a silent
67
+ # `ok`.
68
+ #
57
69
  # ## Usage
58
70
  #
59
71
  # sh scripts/branch-health.sh [-R owner/repo] [--branch dev] [--quiet]
@@ -67,7 +79,7 @@ BRANCH=""
67
79
  QUIET=""
68
80
 
69
81
  usage() {
70
- sed -n '2,60p' "$0" | sed 's/^# \{0,1\}//'
82
+ sed -n '2,73p' "$0" | sed 's/^# \{0,1\}//'
71
83
  exit 2
72
84
  }
73
85
 
@@ -144,13 +156,24 @@ label=${REPO:-$(basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")}
144
156
  # list": the ordering is gh's to change, and a status tool that quietly reports
145
157
  # an older run because an API changed its sort is the same class of defect as the
146
158
  # truncated list this replaces. Ask for the newest explicitly.
159
+ #
160
+ # `displayTitle` is requested here for #1582's second half: a `workflow_dispatch`
161
+ # left at the default `action: plan` runs its plan step for real and concludes
162
+ # "success" — conclusion alone can never tell that apart from a real apply, by
163
+ # design (#1582's whole point). #1678 fixed the Actions-UI half by giving such a
164
+ # run a `run-name` that says "PLAN ONLY ... (nothing applied)"; this line is what
165
+ # lets branch-health.sh see that same marker instead of rendering the run as a
166
+ # plain, indistinguishable "ok". The per-workflow history query further below
167
+ # already requests this field for a different reason (naming who broke a
168
+ # failure) — same field, independent reason to want it here.
147
169
  summary=$(gh_run list --branch "$BRANCH" --limit 200 \
148
- --json workflowName,status,conclusion,headSha,createdAt,url,event \
170
+ --json workflowName,status,conclusion,headSha,createdAt,url,event,displayTitle \
149
171
  --jq 'group_by(.workflowName)
150
172
  | map(max_by(.createdAt))
151
173
  | .[]
152
174
  | [ (if .status == "completed" then (.conclusion // "unknown") else .status end),
153
- .workflowName, .headSha[0:8], .createdAt[0:16], .url, .event ]
175
+ .workflowName, .headSha[0:8], .createdAt[0:16], .url, .event,
176
+ (.displayTitle // "") ]
154
177
  | @tsv' 2>/dev/null)
155
178
 
156
179
  if [ -z "$summary" ]; then
@@ -164,11 +187,24 @@ pending=""
164
187
  cancelled=""
165
188
  skipped=""
166
189
  ok=""
190
+ planonly=""
167
191
 
168
- while IFS="$TAB" read -r state name sha when url event; do
192
+ while IFS="$TAB" read -r state name sha when url event title; do
169
193
  [ -n "$name" ] || continue
170
194
  case "$state" in
171
- success) ok="${ok}${name}\n" ;;
195
+ success)
196
+ # A literal, upper-case "PLAN ONLY" is the #1678 run-name marker
197
+ # (`format('PLAN ONLY {0} (nothing applied)', ...)`) — never something a
198
+ # commit-subject-derived title produces by coincidence (this repo's own
199
+ # history has "plan-only" and "plan-time" in commit subjects, always
200
+ # lower-case, and grep confirms zero for the exact upper-case phrase).
201
+ # A "success" run whose title carries it applied nothing and must not
202
+ # collapse into the same "ok" bucket as a real apply.
203
+ case "$title" in
204
+ *"PLAN ONLY"*) planonly="${planonly}${name}\n" ;;
205
+ *) ok="${ok}${name}\n" ;;
206
+ esac
207
+ ;;
172
208
  failure | timed_out | startup_failure)
173
209
  failed="${failed}${state}\t${name}\t${sha}\t${when}\t${url}\t${event}\n"
174
210
  ;;
@@ -193,6 +229,10 @@ echo
193
229
  [ -n "$ok" ] && printf '%b' "$ok" | sed "s/^/ ${GREEN}ok${OFF} /"
194
230
  [ -n "$skipped" ] && printf '%b' "$skipped" | sed "s/^/ ${DIM}skipped${OFF} /"
195
231
  [ -n "$cancelled" ] && printf '%b' "$cancelled" | sed "s/^/ ${YELLOW}cancelled${OFF} /"
232
+ # Own label, not "ok" — #1582's second half. A skim-reader tells rows apart by
233
+ # this left-hand column, not by reading every run's title, so the row itself
234
+ # has to say "nothing applied" rather than reusing the label a real apply gets.
235
+ [ -n "$planonly" ] && printf '%b' "$planonly" | sed "s/^/ ${YELLOW}plan-only${OFF} /" | sed "s/\$/ — nothing applied/"
196
236
 
197
237
  if [ -n "$pending" ]; then
198
238
  printf '%b' "$pending" | awk -F'\t' -v d="$YELLOW" -v o="$OFF" 'NF{printf " %srunning%s %s (%s)\n", d, o, $2, $1}'
@@ -204,6 +244,11 @@ if [ -z "$failed" ]; then
204
244
  echo "${DIM}A cancelled run is usually spot reclamation or a superseded concurrency${OFF}"
205
245
  echo "${DIM}group, not the code. Re-run it rather than debugging it.${OFF}"
206
246
  fi
247
+ if [ -n "$planonly" ]; then
248
+ echo
249
+ echo "${DIM}A plan-only dispatch did not apply anything — Terraform state is${OFF}"
250
+ echo "${DIM}unchanged for that environment. Not a failure, but not a deploy either.${OFF}"
251
+ fi
207
252
  echo
208
253
  echo "${GREEN}Nothing on '$BRANCH' is failing.${OFF}"
209
254
  exit 0