diff --git a/.github/generate-dist-files-size-diff.mjs b/.github/generate-dist-files-size-diff.mjs index 6df0b3c575..40bd4d03f3 100644 --- a/.github/generate-dist-files-size-diff.mjs +++ b/.github/generate-dist-files-size-diff.mjs @@ -85,14 +85,25 @@ export function main() { return output; } + const displayedPackageRow = new Set(); output += 'Thanks for the PR! Here is the difference in size of the dist files between the base and the PR.\n'; output += 'Please review the changes and make sure they are expected.\n\n'; output += ``; for (const [file, details] of files.entries()) { + const isBridge = file.includes('src/Bridge'); + const packageName = file.split('/')[1]; + const bridgeName = isBridge ? file.split('/')[4] : ''; + const fileShort = file.replace(isBridge ? `src/${packageName}/src/Bridge/${bridgeName}/assets/dist/` : `src/${packageName}/assets/dist/`, ''); + const row = isBridge ? `${packageName} (Bridge ${bridgeName})` : packageName; + if (!displayedPackageRow.has(row)) { + displayedPackageRow.add(row); + output += ``; + } + output += ` - +
FileDiff (B)Diff (%)
${row}
${file} ${details.state === 'added' ? '(new)' : (details.state === 'removed' ? '(deleted)' : '')}${fileShort} ${details.state === 'added' ? '(new)' : (details.state === 'removed' ? '(deleted)' : '')} Size: ${formatBytes(base[file]?.size || 0)}${formatBytes(pr[file]?.size || 0)}
Gzip: ${formatBytes(base[file]?.size_gz || 0)}${formatBytes(pr[file]?.size_gz || 0)}
diff --git a/.github/workflows/dist-files-size-diff.yaml b/.github/workflows/dist-files-size-diff.yaml index 679cec6787..a32bd41e28 100644 --- a/.github/workflows/dist-files-size-diff.yaml +++ b/.github/workflows/dist-files-size-diff.yaml @@ -3,9 +3,8 @@ name: Dist Files Size Diff on: pull_request: paths: - - 'src/*/**' - - '!src/*/doc/**' - - '.github/**' + - 'src/*/assets/dist/**' + - 'src/*/src/Bridge/*/assets/dist/**' jobs: dist-files-size-diff: @@ -60,6 +59,7 @@ jobs: with: result-encoding: string script: | + console.log(context); const { main } = await import('${{ github.workspace }}/.github/generate-dist-files-size-diff.mjs') return await main()