Skip to content

Commit

Permalink
Write out the summary
Browse files Browse the repository at this point in the history
  • Loading branch information
illright committed Dec 17, 2024
1 parent 5eb2bd0 commit 1da13ac
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/bundle-size.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 1da13ac

Please sign in to comment.