From 6c4ed55b321c02f767ceea91198b811f2487d617 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Mon, 29 Jun 2026 06:15:25 -0400 Subject: [PATCH] ci(size-diff): post comment when the artifact extracts flat (single app) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit actions/download-artifact extracts a SINGLE matching artifact's files directly into the target dir, but lands MULTIPLE artifacts in per-artifact subdirs. The comment loop only iterated subdirectories, so single-app PRs (the common case — every release PR) had app/body.md sitting directly in DIR, failed the isDirectory() filter, and the job went green having posted nothing (observed on #1554 and #1440). Iterate DIR itself plus its immediate subdirs so both layouts work, and warn when nothing was posted so a silent miss can't recur. --- .github/workflows/size-diff-comment.yaml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/size-diff-comment.yaml b/.github/workflows/size-diff-comment.yaml index 5bea5d8f1..b98519078 100644 --- a/.github/workflows/size-diff-comment.yaml +++ b/.github/workflows/size-diff-comment.yaml @@ -56,12 +56,20 @@ jobs: return; } - for (const entry of fs.readdirSync(dir)) { - const sub = path.join(dir, entry); - if (!fs.statSync(sub).isDirectory()) continue; + // A single matching artifact extracts flat into DIR; multiple land + // in per-artifact subdirs. Handle both: DIR itself + its subdirs. + const candidates = [dir, ...fs.readdirSync(dir) + .map(e => path.join(dir, e)) + .filter(p => fs.statSync(p).isDirectory())]; - const app = fs.readFileSync(path.join(sub, "app"), "utf8").trim(); - const body = fs.readFileSync(path.join(sub, "body.md"), "utf8"); + let posted = 0; + for (const sub of candidates) { + const appPath = path.join(sub, "app"); + const bodyPath = path.join(sub, "body.md"); + if (!fs.existsSync(appPath) || !fs.existsSync(bodyPath)) continue; + + const app = fs.readFileSync(appPath, "utf8").trim(); + const body = fs.readFileSync(bodyPath, "utf8"); if (!app || !body) continue; if (!body.startsWith("## 📦 App Size Analysis")) { core.warning(`Skipping ${app}: unexpected size-diff body.`); @@ -93,4 +101,7 @@ jobs: body: fullBody, }); } + posted++; } + + if (!posted) core.warning("No size-diff payloads found under the artifact dir.");