@@ -21,6 +21,8 @@ const METRICS = {
2121 "chromeUserTiming.CumulativeLayoutShift" : "Cumulative Layout Shift" ,
2222}
2323
24+ const isReportSupported = ( ) => GH_EVENT_NAME == 'pull_request' || GH_EVENT_NAME == 'issue_comment' ;
25+
2426const runTest = ( wpt , url , options ) => {
2527 // clone options object to avoid WPT wrapper issue
2628 let tempOptions = JSON . parse ( JSON . stringify ( options ) ) ;
@@ -147,7 +149,7 @@ async function run() {
147149 + url + '. Full results at https://'
148150 + wpt . config . hostname + '/result/' + result . result . testId ) ;
149151
150- if ( GH_EVENT_NAME == 'pull_request' ) {
152+ if ( isReportSupported ( ) ) {
151153 let testResults = await retrieveResults ( wpt , result . result . testId ) ;
152154 collectData ( testResults , runData ) ;
153155
@@ -167,7 +169,7 @@ async function run() {
167169 core . info ( 'Tests successfully completed for ' + url
168170 + '. Full results at ' + result . result . data . summary ) ;
169171
170- if ( GH_EVENT_NAME == 'pull_request' ) {
172+ if ( isReportSupported ( ) ) {
171173 let testResults = await retrieveResults ( wpt , result . result . data . id ) ;
172174 collectData ( testResults , runData ) ;
173175 }
@@ -184,12 +186,12 @@ async function run() {
184186 core . setFailed ( `Action failed with error ${ e } ` ) ;
185187 }
186188 } ) ) . then ( ( ) => {
187- if ( GH_EVENT_NAME == 'pull_request' ) {
189+ if ( isReportSupported ( ) ) {
188190 renderComment ( runData ) ;
189191 }
190192 } ) ;
191193
192194 return ;
193195}
194196
195- run ( ) ;
197+ run ( ) ;
0 commit comments