2020-04-28 17:46:47 +03:00
|
|
|
"use strict";
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
var result = {};
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
result["default"] = mod;
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const core = __importStar(require("@actions/core"));
|
2020-08-25 18:19:15 +03:00
|
|
|
const analyze_1 = require("./analyze");
|
2020-08-27 16:04:09 +03:00
|
|
|
const config_utils_1 = require("./config-utils");
|
2020-08-11 14:43:27 +03:00
|
|
|
const logging_1 = require("./logging");
|
|
|
|
const repository_1 = require("./repository");
|
2020-04-28 17:46:47 +03:00
|
|
|
const util = __importStar(require("./util"));
|
2020-08-25 18:19:15 +03:00
|
|
|
async function sendStatusReport(startedAt, stats, error) {
|
2020-07-20 18:33:37 +03:00
|
|
|
var _a, _b, _c;
|
2020-08-25 18:19:15 +03:00
|
|
|
const status = ((_a = stats) === null || _a === void 0 ? void 0 : _a.analyze_failure_language) !== undefined || error !== undefined ? 'failure' : 'success';
|
2020-07-20 18:33:37 +03:00
|
|
|
const statusReportBase = await util.createStatusReportBase('finish', status, startedAt, (_b = error) === null || _b === void 0 ? void 0 : _b.message, (_c = error) === null || _c === void 0 ? void 0 : _c.stack);
|
|
|
|
const statusReport = {
|
|
|
|
...statusReportBase,
|
2020-08-25 18:19:15 +03:00
|
|
|
...(stats || {}),
|
2020-07-20 18:33:37 +03:00
|
|
|
};
|
|
|
|
await util.sendStatusReport(statusReport);
|
|
|
|
}
|
2020-04-28 17:46:47 +03:00
|
|
|
async function run() {
|
2020-07-20 18:33:37 +03:00
|
|
|
const startedAt = new Date();
|
2020-08-25 18:19:15 +03:00
|
|
|
let stats = undefined;
|
2020-04-28 17:46:47 +03:00
|
|
|
try {
|
2020-08-05 00:35:20 +03:00
|
|
|
util.prepareLocalRunEnvironment();
|
2020-08-07 18:43:57 +03:00
|
|
|
if (!await util.sendStatusReport(await util.createStatusReportBase('finish', 'starting', startedAt), true)) {
|
2020-04-28 17:46:47 +03:00
|
|
|
return;
|
|
|
|
}
|
2020-08-27 16:04:09 +03:00
|
|
|
const logger = logging_1.getActionsLogger();
|
|
|
|
const config = await config_utils_1.getConfig(util.getRequiredEnvParam('RUNNER_TEMP'), logger);
|
|
|
|
stats = await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(util.getRequiredEnvParam('GITHUB_REPOSITORY')), await util.getCommitOid(), util.getRef(), await util.getAnalysisKey(), util.getRequiredEnvParam('GITHUB_WORKFLOW'), util.getWorkflowRunID(), core.getInput('checkout_path'), core.getInput('matrix'), core.getInput('token'), util.getRequiredEnvParam('GITHUB_SERVER_URL'), core.getInput('upload') === 'true', 'actions', core.getInput('output'), config, logger);
|
2020-04-28 17:46:47 +03:00
|
|
|
}
|
|
|
|
catch (error) {
|
|
|
|
core.setFailed(error.message);
|
2020-08-05 11:40:28 +03:00
|
|
|
console.log(error);
|
2020-08-25 18:19:15 +03:00
|
|
|
await sendStatusReport(startedAt, stats, error);
|
2020-04-28 17:46:47 +03:00
|
|
|
return;
|
|
|
|
}
|
2020-08-25 18:19:15 +03:00
|
|
|
await sendStatusReport(startedAt, stats);
|
2020-04-28 17:46:47 +03:00
|
|
|
}
|
|
|
|
run().catch(e => {
|
|
|
|
core.setFailed("analyze action failed: " + e);
|
|
|
|
console.log(e);
|
|
|
|
});
|
2020-08-24 17:09:02 +03:00
|
|
|
//# sourceMappingURL=analyze-action.js.map
|