Skip to content

Commit fe49f3f

Browse files
authored
Update index.js
1 parent 582880b commit fe49f3f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
2426
const 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

Comments
 (0)