From 1da13ac36a597fc7eae23d860eab1a13a8b3f9fa Mon Sep 17 00:00:00 2001 From: Lev Chelyadinov Date: Tue, 17 Dec 2024 02:05:23 +0100 Subject: [PATCH] Write out the summary --- .github/workflows/bundle-size.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bundle-size.yaml b/.github/workflows/bundle-size.yaml index 8a1b60c..5d26b72 100644 --- a/.github/workflows/bundle-size.yaml +++ b/.github/workflows/bundle-size.yaml @@ -71,14 +71,14 @@ jobs: const fs = require('fs'); const sizes = parseDuOutput(fs.readFileSync(`sizes-${${{ toJson(github.base_ref) }}}.txt`, 'utf8')); const sizesPR = parseDuOutput(fs.readFileSync(`sizes-${${{ toJson(github.head_ref) }}}.txt`, 'utf8')); - const report = [ - '### 📊 Package size report', - '', - '| Package | Before | After |', - ...Object.keys(sizes).map((packageName) => { - const size = sizes[packageName]; - const sizePR = sizesPR[packageName]; - return `| ${packageName} | ${formatSize(size)} | ${sizePR === size ? 'No change' : formatSize(sizePR)} |`; - }), - ].join('\n'); - core.summary.addRaw(report, /* addEOL: */ true); + core.summary.addHeading('📊 Package size report', '3'); + core.summary.addTable([ + { data: 'Package', header: true }, + { data: 'Before', header: true }, + { data: 'After', header: true }, + ].concat(Object.keys(sizes).flatMap((packageName) => { + const size = sizes[packageName]; + const sizePR = sizesPR[packageName]; + return [packageName, formatSize(size), sizePR === size ? 'No change' : formatSize(sizePR)]; + })); + core.summary.write();