@biffo/cli 0.247.5 → 0.247.7
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/claim.sh +24 -0
package/package.json
CHANGED
package/scripts/claim.sh
CHANGED
|
@@ -126,6 +126,7 @@ OFF=$(printf '\033[0m')
|
|
|
126
126
|
|
|
127
127
|
gh_issue() { if [ -n "$REPO" ]; then gh issue "$@" --repo "$REPO"; else gh issue "$@"; fi; }
|
|
128
128
|
gh_pr() { if [ -n "$REPO" ]; then gh pr "$@" --repo "$REPO"; else gh pr "$@"; fi; }
|
|
129
|
+
gh_label() { if [ -n "$REPO" ]; then gh label "$@" --repo "$REPO"; else gh label "$@"; fi; }
|
|
129
130
|
|
|
130
131
|
# `git ls-remote --heads ""` fails outright ("fatal: bad repository ''") rather
|
|
131
132
|
# than falling back to the default remote — `${REPO:+url}` expands to an empty
|
|
@@ -329,6 +330,29 @@ if [ -n "$CHECK_ONLY" ]; then
|
|
|
329
330
|
exit 0
|
|
330
331
|
fi
|
|
331
332
|
|
|
333
|
+
# Make sure the label EXISTS before trying to apply it (#1289).
|
|
334
|
+
#
|
|
335
|
+
# AGENTS.md requires this label, and nothing ever created it. It was absent in
|
|
336
|
+
# 12 of 16 estate repos, so `claim` could never return 0 there: the add below
|
|
337
|
+
# failed and the script exited 2, "cannot tell", on every issue, for ever. The
|
|
338
|
+
# coordination gate was structurally unable to pass in three quarters of the
|
|
339
|
+
# estate, and nobody noticed because the two repos where claiming is exercised
|
|
340
|
+
# most -- biffo-template and tabsii-platform -- were among the four that had it.
|
|
341
|
+
#
|
|
342
|
+
# Creating it here rather than in a setup step is deliberate: a label that only
|
|
343
|
+
# exists where somebody remembered to run something is the same defect one step
|
|
344
|
+
# removed. This runs on the claim path, so the mechanism repairs itself in any
|
|
345
|
+
# repo where it is used, including one scaffolded tomorrow.
|
|
346
|
+
#
|
|
347
|
+
# Idempotent, and NOT fatal on failure: `gh label create` exits non-zero when the
|
|
348
|
+
# label already exists, which is the overwhelmingly common case. A real failure
|
|
349
|
+
# (no permission, no network) surfaces on the add immediately below, which IS
|
|
350
|
+
# fatal -- so a broken claim still refuses rather than pretending.
|
|
351
|
+
gh_label create "$LABEL" \
|
|
352
|
+
-c FBCA04 \
|
|
353
|
+
-d "Claimed by a running agent session -- do not start work on this" \
|
|
354
|
+
>/dev/null 2>&1 || true
|
|
355
|
+
|
|
332
356
|
# Claim it. Label AND comment together: the label is what other sessions filter
|
|
333
357
|
# on, the comment is what dates it so a stale claim can be recognised later.
|
|
334
358
|
gh_issue edit "$ISSUE" --add-label "$LABEL" >/dev/null 2>&1 || {
|