|
|
@@ -25,13 +25,22 @@ GH_BIN="${GH:-gh}"
|
|
|
GH_TOKEN="${GH_TOKEN:-${GITHUB_TOKEN:-}}"
|
|
|
export GH_TOKEN
|
|
|
|
|
|
-# 列出未关闭的自动升级失败 Issue,标题含目标版本即命中
|
|
|
-# simp: gh 仅输出 JSON,匹配交给 jq(mock 易仿真);查询上限 50 条,按版本去重后远不会触及
|
|
|
+# 列出未关闭的自动升级失败 Issue,标题含目标版本即命中(匹配在下方按版本边界进行)
|
|
|
#
|
|
|
# List open auto-upgrade failure Issues; a title containing the target version is a hit
|
|
|
+# (matching below is done at version boundaries)
|
|
|
+# simp: gh 仅输出 JSON,匹配交给 jq(mock 易仿真);查询上限 50 条,按版本去重后远不会触及
|
|
|
+#
|
|
|
# simp: gh only outputs JSON, matching is delegated to jq (easy to mock); cap of 50 is far above the deduped per-version count
|
|
|
JSON="$("$GH_BIN" issue list --state open --search 'in:title "[自动升级]"' --json title,number --limit 50 2>/dev/null || true)"
|
|
|
[ -n "$JSON" ] || { echo 0; exit 0; }
|
|
|
|
|
|
-MATCH="$(jq -r '.[] | select(.title | contains("'"$VERSION"'")) | .number' <<<"$JSON" | head -n1)"
|
|
|
+# 版本边界匹配(与 check-pr-gate.sh / upgrade-dsh.sh 同思想):先转义 VERSION 为正则字面量,
|
|
|
+# 再要求前后均非版本字符,避免 0.2.0 误匹配标题中的 0.2.0-rc.1(npm 版本字符集 [0-9A-Za-z.-])
|
|
|
+#
|
|
|
+# Version-boundary match (same idea as check-pr-gate.sh / upgrade-dsh.sh): escape VERSION to a
|
|
|
+# regex literal, then require non-version characters on both sides, so 0.2.0 is never matched as
|
|
|
+# a prefix of 0.2.0-rc.1 in a title (npm version chars [0-9A-Za-z.-])
|
|
|
+ESC="$(printf '%s' "$VERSION" | sed 's/[][\\^$.|*+?()]/\\&/g')"
|
|
|
+MATCH="$(jq -r --arg v "$ESC" '.[] | select(.title | test("(^|[^-0-9A-Za-z.])" + $v + "([^-0-9A-Za-z.]|$)")) | .number' <<<"$JSON" | head -n1)"
|
|
|
[ -n "$MATCH" ] && echo 1 || echo 0
|