fix(ci): indent python3 -c body so YAML block scalar parses
Some checks failed
CI / Deploy (pull_request) Has been skipped
PR → Build → devicectl Deploy → LGTM / Build & Deploy to iPhone (devicectl) (pull_request) Successful in 2m39s
PR → Build → devicectl Deploy → LGTM / Wait for LGTM comment (pull_request) Failing after 31s
PR → Build → devicectl Deploy → LGTM / Detect Changes (pull_request) Successful in 3s
CI / Detect Changes (pull_request) Successful in 4s
CI / YouTube Worker (pull_request) Has been skipped
Some checks failed
CI / Deploy (pull_request) Has been skipped
PR → Build → devicectl Deploy → LGTM / Build & Deploy to iPhone (devicectl) (pull_request) Successful in 2m39s
PR → Build → devicectl Deploy → LGTM / Wait for LGTM comment (pull_request) Failing after 31s
PR → Build → devicectl Deploy → LGTM / Detect Changes (pull_request) Successful in 3s
CI / Detect Changes (pull_request) Successful in 4s
CI / YouTube Worker (pull_request) Has been skipped
The python3 inline script in wait-approval was written at column 0 (lines 257-283), but YAML block scalars require content to be more indented than the parent key. YAML exited the run: | block at the first column-0 line ("import json, re, sys") and tried to parse the python as YAML, failing with "could not find expected :" at line 257 — which prevented pr-iphone-deploy.yml from running at all (no run was ever created for PRs that touched only the workflow file).
Fix: switch to python3 -c with the body indented to sit inside the run: | block scalar.
Verified locally:
- yaml.safe_load parses the workflow cleanly (jobs: changes, build-deploy, wait-approval).
- The extracted python, run exactly as act will execute it, returns:
bot-only -> PENDING (was self-merging before)
bot + reviewer LGTM -> LGTM (squash-merge still fires)
bot + reviewer KO -> KO (block still fires)
This commit is contained in:
55
.github/workflows/pr-iphone-deploy.yml
vendored
55
.github/workflows/pr-iphone-deploy.yml
vendored
@@ -253,34 +253,33 @@ jobs:
|
||||
COMMENTS=$(curl -s -H "Authorization: token ${GT_TOKEN}" \
|
||||
"${API}/issues/${PR}/comments?limit=50&page=1")
|
||||
|
||||
DECISION=$(python3 - "$COMMENTS" <<'PY'
|
||||
import json, re, sys
|
||||
MARKER = "<!-- tabatago:ready-to-test -->"
|
||||
try:
|
||||
comments = json.loads(sys.argv[1] or "[]")
|
||||
except Exception:
|
||||
comments = []
|
||||
lgtm = re.compile(r"\bLGTM\b", re.IGNORECASE)
|
||||
ko = re.compile(r"\bKO\b", re.IGNORECASE)
|
||||
hit_lgtm = hit_ko = False
|
||||
for c in comments:
|
||||
body = c.get("body") or ""
|
||||
if MARKER in body:
|
||||
# Skip the bot's own "Ready to test" comment — its body mentions
|
||||
# LGTM/KO as instructions and would otherwise self-trigger.
|
||||
continue
|
||||
if ko.search(body):
|
||||
hit_ko = True
|
||||
if lgtm.search(body):
|
||||
hit_lgtm = True
|
||||
if hit_ko:
|
||||
print("KO")
|
||||
elif hit_lgtm:
|
||||
print("LGTM")
|
||||
else:
|
||||
print("PENDING")
|
||||
PY
|
||||
)
|
||||
DECISION=$(python3 -c '
|
||||
import json, re, sys
|
||||
MARKER = "<!-- tabatago:ready-to-test -->"
|
||||
try:
|
||||
comments = json.loads(sys.argv[1] or "[]")
|
||||
except Exception:
|
||||
comments = []
|
||||
lgtm = re.compile(r"\bLGTM\b", re.IGNORECASE)
|
||||
ko = re.compile(r"\bKO\b", re.IGNORECASE)
|
||||
hit_lgtm = hit_ko = False
|
||||
for c in comments:
|
||||
body = c.get("body") or ""
|
||||
if MARKER in body:
|
||||
# Skip bot comments — their body contains LGTM/KO as reviewer
|
||||
# instructions and would otherwise self-trigger a merge.
|
||||
continue
|
||||
if ko.search(body):
|
||||
hit_ko = True
|
||||
if lgtm.search(body):
|
||||
hit_lgtm = True
|
||||
if hit_ko:
|
||||
print("KO")
|
||||
elif hit_lgtm:
|
||||
print("LGTM")
|
||||
else:
|
||||
print("PENDING")
|
||||
' "$COMMENTS")
|
||||
|
||||
case "$DECISION" in
|
||||
LGTM)
|
||||
|
||||
Reference in New Issue
Block a user