File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
apps/site/scripts/compare-size Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 11name : Compare Bundle Size
22
33on :
4- pull_request :
5- # workflow_run:
6- # workflows: ['Build']
7- # types: [completed]
4+ workflow_run :
5+ workflows : ['Build']
6+ types : [completed]
87
98permissions :
109 contents : read
@@ -31,16 +30,16 @@ jobs:
3130 with :
3231 name : webpack-stats
3332 path : head-stats
34- run-id : 18860058714
33+ run-id : ${{ github.event.workflow_run.workflow_id }}
3534 github-token : ${{ secrets.GITHUB_TOKEN }}
3635
3736 - name : Get Run ID from BASE
3837 id : base-run
3938 env :
40- WORKFLOW_ID : ${{ github.event.workflow_run.workflow_id || 64771488 }}
39+ WORKFLOW_ID : ${{ github.event.workflow_run.workflow_id }}
4140 GH_TOKEN : ${{ github.token }}
4241 run : |
43- ID=$(gh run list -c 95f43b01b7790b2af237d3dd6f015d2212dd495f -w $WORKFLOW_ID -L 1 --json databaseId --jq ".[].databaseId")
42+ ID=$(gh run list -c $GITHUB_SHA -w $WORKFLOW_ID -L 1 --json databaseId --jq ".[].databaseId")
4443 echo "run_id=$ID" >> $GITHUB_OUTPUT
4544
4645 - name : Download Stats (BASE)
6564 - name : Add Comment to PR
6665 uses : thollander/actions-comment-pull-request@e2c37e53a7d2227b61585343765f73a9ca57eda9 # v3.0.0
6766 with :
68- comment-tag : " compare_bundle_size"
67+ comment-tag : ' compare_bundle_size'
6968 message : ${{ steps.compare-bundle-size.outputs.comment }}
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ import { readFile } from 'node:fs/promises';
66 * @returns {string } Formatted string (e.g., "1.5 KB")
77 */
88const formatBytes = bytes => {
9- if ( bytes === 0 ) { return '0 B' ; }
9+ if ( bytes === 0 ) {
10+ return '0 B' ;
11+ }
1012 const units = [ 'B' , 'KB' , 'MB' , 'GB' ] ;
1113 const index = Math . floor ( Math . log ( Math . abs ( bytes ) ) / Math . log ( 1024 ) ) ;
1214 return ( bytes / Math . pow ( 1024 , index ) ) . toFixed ( 2 ) + ' ' + units [ index ] ;
@@ -58,7 +60,9 @@ const categorizeChanges = (oldAssets, newAssets) => {
5860 * Builds a collapsible table section
5961 */
6062const tableSection = ( title , items , columns , icon ) => {
61- if ( ! items . length ) { return '' ; }
63+ if ( ! items . length ) {
64+ return '' ;
65+ }
6266 const header = `| ${ columns . map ( c => c . label ) . join ( ' | ' ) } |\n` ;
6367 const separator = `| ${ columns . map ( ( ) => '---' ) . join ( ' | ' ) } |\n` ;
6468 const rows = items
You can’t perform that action at this time.
0 commit comments