From bb29722b7d20367ceeef67dd7dd8dde2175ef07e Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 6 Dec 2026 11:53:24 +0800 Subject: [PATCH] refactor(ci): share failure report Markdown output --- scripts/ci/failure-report.mjs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/ci/failure-report.mjs b/scripts/ci/failure-report.mjs index 37ff6e23bd..5587343612 100644 --- a/scripts/ci/failure-report.mjs +++ b/scripts/ci/failure-report.mjs @@ -503,15 +503,12 @@ async function writeFailureReport( await mkdir(outputDirectory, { recursive: true }); const jsonPath = join(outputDirectory, "report.json"); const markdownPath = join(outputDirectory, "report.md"); - const matchedDiagnostics = report.failures.filter( - (item) => item.classification === "matching-main-diagnostics", - ); const lines = [ "# CI failure attribution", "", "Informational only. This report never changes a CI conclusion or required gate.", "", - `Observed ${report.observedAt}; ${String(matchedDiagnostics.length)} of ${String(report.failures.length)} failure reports contain supported diagnostics matching a failed static task on an ancestor main revision. This does not attribute other failures in the same job. Unknown means evidence was incomplete or did not match.`, + `Observed ${report.observedAt}; ${String(report.counts["matching-main-diagnostics"])} of ${String(report.failures.length)} failure reports contain supported diagnostics matching a failed static task on an ancestor main revision. This does not attribute other failures in the same job. Unknown means evidence was incomplete or did not match.`, "", ]; for (const item of report.failures) @@ -523,10 +520,9 @@ async function writeFailureReport( "- No completed failed CI attempts were present in the supplied timing snapshot.", ); await writeFile(jsonPath, `${JSON.stringify(report, null, 2)}\n`, "utf8"); - await writeFile(markdownPath, `${lines.join("\n")}\n`, "utf8"); - if (summaryPath) - await appendFile(summaryPath, `${lines.join("\n")}\n`, "utf8"); - return { jsonPath, markdownPath }; + const markdown = `${lines.join("\n")}\n`; + await writeFile(markdownPath, markdown, "utf8"); + if (summaryPath) await appendFile(summaryPath, markdown, "utf8"); } async function main() {