Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
talemke committed Jun 9, 2020
1 parent c7db98b commit d369005
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());



Expand All @@ -22,13 +22,29 @@ 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();
}

console.log('Done! Result:');
console.log('-------------\n');
console.log(output);

core.setOutput('warnings', 0);
core.setOutput('errors', 0);
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);

0 comments on commit d369005

Please sign in to comment.