diff --git a/index.js b/index.js index 647cadf..91b0f8c 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,7 @@ const exec = require('child_process'); // Fetch NodeJS version (and also test exec functionality) let result = exec.execSync('node -v'); -console.log('Running 8 NodeJS ' + result.toString('utf-8').trim()); +console.log('Running NodeJS ' + result.toString('utf-8').trim()); @@ -22,7 +22,7 @@ try { let result2 = exec.execSync('./glualint ' + process.env.GITHUB_WORKSPACE, { cwd: __dirname + '/dependencies' }); output = result2.stdout.toString('utf-8').trim(); } catch (error) { - console.log(error); + // console.log(error); output = error.stdout.toString('utf-8').trim(); } @@ -30,5 +30,21 @@ console.log('Done! Result:'); console.log('-------------\n'); console.log(output); -core.setOutput('warnings', 0); -core.setOutput('errors', 0); \ No newline at end of file +if (!output.includes('[Error]')) return; + +let message = ''; +let errors = 0; +let warnings = 0; +let elements = output.split('\n'); + +for (let i = 0; i < elements.length; i++) { + if (elements[i].includes('[Error]')) { + message += '\n' + elements[i]; + errors++; + } else if (elements[i].includes('[Warning]')) { + warnings++; + } +} + +message = 'Found ' + errors + ' errors and ' + warnings + ' warnings:\n\n' + message; +core.setFailed(message); \ No newline at end of file