in lib/main.js [92:126]
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const linterOutputPath = core.getInput('linter_output_path');
console.log(`Reading linter output from: ${GITHUB_WORKSPACE}/${linterOutputPath}`);
const output = yield fs.promises.readFile(`${GITHUB_WORKSPACE}/${linterOutputPath}`);
const mode = core.getInput('mode');
let annotations;
if (mode === 'regex') {
const regex = core.getInput('regex');
annotations = parseOutputLines(output.toString(), RegExp(regex));
}
else if (mode === 'json') {
annotations = parseOutputJSON(output.toString());
}
else {
throw `Mode '${mode}' not recognized.`;
}
if (annotations.length > 0) {
console.log("===============================================================");
console.log("| FAILURES DETECTED |");
console.log("| You don't need to read this log output. |");
console.log("| Check the 'Files changed' tab for in-line annotations! |");
console.log("===============================================================");
console.log(annotations);
const checkName = core.getInput('check_name');
yield createCheck(checkName, 'failures detected', annotations);
console.log(`${annotations.length} errors(s) found`);
}
}
catch (error) {
core.setFailed(error.message);
}
});
}