From bcf45a8c12b99d08b1ffab0ed08cc76516c74c77 Mon Sep 17 00:00:00 2001 From: s1gr1d <32902192+s1gr1d@users.noreply.github.com> Date: Mon, 23 Feb 2026 14:58:15 +0100 Subject: [PATCH] chore(triage-action): Fix JSON parsing --- .../triage-issue/scripts/write_job_summary.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.claude/skills/triage-issue/scripts/write_job_summary.py b/.claude/skills/triage-issue/scripts/write_job_summary.py index 44eb1847b2da..48b31955607f 100644 --- a/.claude/skills/triage-issue/scripts/write_job_summary.py +++ b/.claude/skills/triage-issue/scripts/write_job_summary.py @@ -6,8 +6,10 @@ Usage: python3 write_job_summary.py -Handles single JSON object or NDJSON (one JSON object per line). -Uses the last object with type "result" when multiple are present. +The execution file is written by anthropics/claude-code-action as a single +JSON array of messages (JSON.stringify(messages, null, 2)) at +$RUNNER_TEMP/claude-execution-output.json. We also support NDJSON (one +object per line). Uses the last object with type "result" for metrics. Job summary has a ~1MB limit; raw JSON is truncated if needed to avoid job abort. """ @@ -52,17 +54,25 @@ def main() -> int: continue try: obj = json.loads(line) - if obj.get("type") == "result": + if isinstance(obj, dict) and obj.get("type") == "result": results.append(obj) + elif isinstance(obj, list): + for item in obj: + if isinstance(item, dict) and item.get("type") == "result": + results.append(item) except json.JSONDecodeError: continue if not results: - # Try parsing whole content as single JSON + # Try parsing whole content as single JSON (object or array) try: obj = json.loads(content) - if obj.get("type") == "result": + if isinstance(obj, dict) and obj.get("type") == "result": results = [obj] + elif isinstance(obj, list): + for item in obj: + if isinstance(item, dict) and item.get("type") == "result": + results.append(item) except json.JSONDecodeError: pass