11const WebPageTest = require ( "webpagetest" ) ;
22const core = require ( "@actions/core" ) ;
33const github = require ( '@actions/github' ) ;
4-
54const ejs = require ( 'ejs' ) ;
65
76const WPT_BUDGET = core . getInput ( 'budget' ) ;
@@ -16,6 +15,7 @@ const runTest = (wpt, url, options) => {
1615 let tempOptions = JSON . parse ( JSON . stringify ( options ) ) ;
1716
1817 return new Promise ( ( resolve , reject ) => {
18+ core . info ( `Submitting test for ${ url } ...` ) ;
1919 wpt . runTest ( url , tempOptions , async ( err , result ) => {
2020 try {
2121 if ( result ) {
@@ -45,14 +45,12 @@ async function renderComment(data) {
4545 try {
4646 const octokit = github . getOctokit ( GITHUB_TOKEN , { log : console } ) ;
4747 const context = github . context ;
48- console . info ( data ) ;
4948 let markdown = await ejs . renderFile ( './templates/comment.md' , data ) ;
5049 markdown
5150 . replace ( / \% / g, '%25' )
5251 . replace ( / \n / g, '%0A' )
5352 . replace ( / \r / g, '%0D' )
5453
55- core . info ( markdown ) ;
5654 //submit a comment
5755 await octokit . issues . createComment ( {
5856 owner : context . repo . owner ,
@@ -61,7 +59,7 @@ async function renderComment(data) {
6159 body : markdown
6260 } ) ;
6361 } catch ( e ) {
64- core . info ( e ) ;
62+ core . setFailed ( `Action failed with error ${ e } ` ) ;
6563 }
6664}
6765async function run ( ) {
@@ -137,12 +135,12 @@ async function run() {
137135 return ;
138136 }
139137 } catch ( e ) {
140- core . info ( e ) ;
138+ core . setFailed ( `Action failed with error ${ e } ` ) ;
141139 }
142140
143141 } ) ;
144142 } catch ( e ) {
145- console . info ( e ) ;
143+ core . setFailed ( `Action failed with error ${ e } ` ) ;
146144 }
147145 } ) ) . then ( ( ) => {
148146 if ( GH_EVENT_NAME == 'pull_request' ) {
0 commit comments