From 758317a828964ecd1f8168c2edf7625c3ba16f0b Mon Sep 17 00:00:00 2001 From: wangzhizhou <824219521@qq.com> Date: Tue, 10 Nov 2026 11:05:55 +0800 Subject: [PATCH] fix(ops): never split check names on commas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Matrix check names contain commas, e.g. `build (platform=macOS, macos, OrzMC-local)`. enable-ai-gate.sh joined the derived contexts with commas and split them again for the JSON body, so OrzMCApp ended up requiring five bogus checks (`build (platform=macOS`, `macos`, ...) that can never report — a permanent merge block. - carry contexts as newline-separated internally - add --contexts-file for names with commas - document the limitation of --contexts --- scripts/enable-ai-gate.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/enable-ai-gate.sh b/scripts/enable-ai-gate.sh index 46c6faf..f55495b 100644 --- a/scripts/enable-ai-gate.sh +++ b/scripts/enable-ai-gate.sh @@ -11,7 +11,8 @@ # # Usage: # bash scripts/enable-ai-gate.sh [more...] [options] -# --contexts "a,b" explicit check contexts +# --contexts "a,b" explicit check contexts (simple names only) +# --contexts-file FILE explicit check contexts, one per line (matrix names) # --approvals N required approvals (default 0) # --strict require branches to be up to date (default off) # --dry-run print what would change @@ -25,7 +26,8 @@ DRY=0 while [ $# -gt 0 ]; do case "$1" in - --contexts) CONTEXTS="${2:-}"; shift 2 ;; + --contexts) CONTEXTS="${2:-}"; shift 2 ;; # comma-separated; matrix names with commas: use --contexts-file + --contexts-file) CONTEXTS="$(cat "${2:-}")"; shift 2 ;; --approvals) APPROVALS="${2:-0}"; shift 2 ;; --strict) STRICT="true"; shift ;; --dry-run) DRY=1; shift ;; @@ -109,7 +111,7 @@ PYEOF apply_checks() { local repo="$1" branch="$2" contexts="$3" json_contexts rs_id body - json_contexts=$(printf '%s' "$contexts" | python3 -c 'import json,sys; print(json.dumps([c.strip() for c in sys.stdin.read().split(",") if c.strip()]))') + json_contexts=$(printf '%s' "$contexts" | python3 -c 'import json,sys; print(json.dumps([c.strip() for c in sys.stdin.read().splitlines() if c.strip()]))') if gh api -X PUT "repos/$repo/branches/$branch/protection/required_status_checks" \ --input - >/dev/null 2>&1 <