From: Daan De Meyer Date: Wed, 1 Apr 2026 13:47:34 +0000 (+0200) Subject: ci: base64 encode multiline strings in structured output X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60b10fa0f1e91c3d4d017c10ad3941ac439ea195;p=thirdparty%2Fsystemd.git ci: base64 encode multiline strings in structured output Avoid claude trying to escape characters in the structured JSON by just having it base64 encode the multiline strings in the structured JSON. --- diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 63bcbc6b5da..2f9c76990d2 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -355,8 +355,11 @@ jobs: ## Review result Produce your review result as structured output. The fields are: - - `summary`: Markdown summary for the tracking comment. + - `summary`: The markdown summary for the tracking comment, **base64-encoded**. + Write the summary to a temporary file first, then encode it with + `base64 -w0 /tmp/summary.md` and put the resulting string in this field. - `comments`: Array of review comments (same schema as the reviewer output above). + The `body` field of each comment must also be **base64-encoded** the same way. - `resolve`: REST API IDs of review comment threads to resolve. PROMPT @@ -449,7 +452,7 @@ jobs: if (Array.isArray(review.resolve)) resolveIds = review.resolve; if (typeof review.summary === "string") - summary = review.summary; + summary = Buffer.from(review.summary, "base64").toString("utf-8"); } catch (e) { core.warning(`Failed to parse structured output: ${e.message}`); } @@ -480,7 +483,7 @@ jobs: ...(c.side != null && { side: c.side }), ...(c.start_line != null && { start_line: c.start_line }), ...(c.start_side != null && { start_side: c.start_side }), - body: `Claude: **${c.severity}**: ${c.body}`, + body: `Claude: **${c.severity}**: ${Buffer.from(c.body, "base64").toString("utf-8")}`, }); posted++; } catch (e) {