@biffo/cli 0.247.8 → 0.247.9
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 +33 -6
package/package.json
CHANGED
package/scripts/claim.sh
CHANGED
|
@@ -128,6 +128,29 @@ gh_issue() { if [ -n "$REPO" ]; then gh issue "$@" --repo "$REPO"; else gh issue
|
|
|
128
128
|
gh_pr() { if [ -n "$REPO" ]; then gh pr "$@" --repo "$REPO"; else gh pr "$@"; fi; }
|
|
129
129
|
gh_label() { if [ -n "$REPO" ]; then gh label "$@" --repo "$REPO"; else gh label "$@"; fi; }
|
|
130
130
|
|
|
131
|
+
# This repo as `owner/name`, so a closing reference can be checked against it.
|
|
132
|
+
# GitHub records a CROSS-REPO closing reference in the same list as a local one
|
|
133
|
+
# -- tabsii-lms#43 closes tabsii-platform#553 -- so the number alone is not an
|
|
134
|
+
# answer, and matching on it reproduces the very defect this replaces (#1281).
|
|
135
|
+
#
|
|
136
|
+
# Resolved LAZILY, on first use. Computing it at load cost a `gh repo view` on
|
|
137
|
+
# every single push, including the overwhelmingly common case where `--guard`
|
|
138
|
+
# skips silently because the branch names no issue -- a guard that is meant to
|
|
139
|
+
# touch nothing was suddenly making a network call per push.
|
|
140
|
+
SLUG=""
|
|
141
|
+
SLUG_RESOLVED=""
|
|
142
|
+
repo_slug() {
|
|
143
|
+
if [ -z "$SLUG_RESOLVED" ]; then
|
|
144
|
+
SLUG_RESOLVED=1
|
|
145
|
+
if [ -n "$REPO" ]; then
|
|
146
|
+
SLUG="$REPO"
|
|
147
|
+
else
|
|
148
|
+
SLUG=$(gh repo view --json nameWithOwner --jq .nameWithOwner 2>/dev/null || echo "")
|
|
149
|
+
fi
|
|
150
|
+
fi
|
|
151
|
+
printf '%s' "$SLUG"
|
|
152
|
+
}
|
|
153
|
+
|
|
131
154
|
# `git ls-remote --heads ""` fails outright ("fatal: bad repository ''") rather
|
|
132
155
|
# than falling back to the default remote — `${REPO:+url}` expands to an empty
|
|
133
156
|
# STRING ARGUMENT when $REPO is unset, not to no argument at all. That silently
|
|
@@ -171,9 +194,11 @@ if [ -n "$GUARD_BRANCH" ]; then
|
|
|
171
194
|
cannot_tell_reasons=""
|
|
172
195
|
|
|
173
196
|
# --- an open PR referencing the issue, excluding our own branch's PR --------
|
|
197
|
+
slug=$(repo_slug)
|
|
174
198
|
pr_err=$(mktemp)
|
|
175
|
-
|
|
176
|
-
|
|
199
|
+
slug=$(repo_slug)
|
|
200
|
+
open_prs=$(gh_pr list --state open --limit 100 --json number,headRefName,closingIssuesReferences \
|
|
201
|
+
--jq "[.[] | select(([.closingIssuesReferences[]? | select(.number == $guard_issue and ((.repository.owner.login + \"/\" + .repository.name) == \"$slug\"))] | length > 0) or (.headRefName | test(\"(^|[^0-9])$guard_issue([^0-9]|\$)\")))] | .[] | select(.headRefName != \"$GUARD_BRANCH\") | \"#\(.number) \(.headRefName)\"" \
|
|
177
202
|
2>"$pr_err")
|
|
178
203
|
pr_status=$?
|
|
179
204
|
pr_err_text=$(cat "$pr_err")
|
|
@@ -275,8 +300,9 @@ esac
|
|
|
275
300
|
# Matches the issue number in the title or body as a whole number, so #118 does
|
|
276
301
|
# not match #1188.
|
|
277
302
|
|
|
278
|
-
|
|
279
|
-
|
|
303
|
+
slug=$(repo_slug)
|
|
304
|
+
open_prs=$(gh_pr list --state open --limit 100 --json number,headRefName,closingIssuesReferences \
|
|
305
|
+
--jq "[.[] | select(([.closingIssuesReferences[]? | select(.number == $ISSUE and ((.repository.owner.login + \"/\" + .repository.name) == \"$slug\"))] | length > 0) or (.headRefName | test(\"(^|[^0-9])$ISSUE([^0-9]|\$)\")))] | .[] | \"#\(.number) \(.headRefName)\"" 2>/dev/null)
|
|
280
306
|
|
|
281
307
|
if [ -n "$open_prs" ]; then
|
|
282
308
|
printf '%s\n' "$open_prs" | while IFS= read -r pr; do
|
|
@@ -305,8 +331,9 @@ fi
|
|
|
305
331
|
# Not "taken" — "possibly already done". #1165 was built and merged in three
|
|
306
332
|
# minutes; the only trace afterwards is a merged PR.
|
|
307
333
|
|
|
308
|
-
|
|
309
|
-
|
|
334
|
+
slug=$(repo_slug)
|
|
335
|
+
merged=$(gh_pr list --state merged --limit 30 --json number,mergedAt,closingIssuesReferences \
|
|
336
|
+
--jq "[.[] | select(([.closingIssuesReferences[]? | select(.number == $ISSUE and ((.repository.owner.login + \"/\" + .repository.name) == \"$slug\"))] | length > 0))] | .[0] | select(. != null) | \"#\(.number) merged \(.mergedAt[0:16])\"" 2>/dev/null)
|
|
310
337
|
|
|
311
338
|
if [ -n "$merged" ]; then
|
|
312
339
|
echo " ${YELLOW}merged${OFF} $merged"
|