@@ -27,8 +27,12 @@ async function fetchPreviousComment(octokit, repo, pr) {
27
27
}
28
28
29
29
class SizeLimit {
30
- formatBytes ( size ) {
31
- return bytes . format ( size , { unitSeparator : ' ' } ) ;
30
+ formatBytes ( size , sizeLimit , passed ) {
31
+ if ( passed ) {
32
+ return bytes . format ( size , { unitSeparator : ' ' } ) ;
33
+ }
34
+
35
+ return `⛔️ ${ bytes . format ( size , { unitSeparator : ' ' } ) } (max: ${ bytes . format ( sizeLimit , { unitSeparator : ' ' } ) } )` ;
32
36
}
33
37
34
38
formatPercentageChange ( base = 0 , current = 0 ) {
@@ -84,7 +88,7 @@ class SizeLimit {
84
88
formatSizeResult ( name , base , current ) {
85
89
return [
86
90
name ,
87
- this . formatBytes ( current . size ) ,
91
+ this . formatBytes ( current . size , current . sizeLimit , current . passed ) ,
88
92
this . formatPercentageChange ( base . size , current . size ) ,
89
93
this . formatChange ( base . size , current . size ) ,
90
94
] ;
@@ -100,6 +104,8 @@ class SizeLimit {
100
104
[ result . name ] : {
101
105
name : result . name ,
102
106
size : + result . size ,
107
+ sizeLimit : + result . sizeLimit ,
108
+ passed : result . passed || false ,
103
109
} ,
104
110
} ;
105
111
} , { } ) ;
0 commit comments