codeql-action/lib/autobuild.js

33 строки
1.6 KiB
JavaScript
Исходник Обычный вид История

2020-08-25 18:19:15 +03:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
2021-07-27 19:59:59 +03:00
exports.runAutobuild = exports.determineAutobuildLanguage = void 0;
2020-08-25 18:19:15 +03:00
const codeql_1 = require("./codeql");
const languages_1 = require("./languages");
function determineAutobuildLanguage(config, logger) {
// Attempt to find a language to autobuild
// We want pick the dominant language in the repo from the ones we're able to build
// The languages are sorted in order specified by user or by lines of code if we got
// them from the GitHub API, so try to build the first language on the list.
const autobuildLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l, logger));
const language = autobuildLanguages[0];
if (!language) {
logger.info("None of the languages in this project require extra build steps");
return undefined;
2020-08-25 18:19:15 +03:00
}
logger.debug(`Detected dominant traced language: ${language}`);
if (autobuildLanguages.length > 1) {
2020-09-14 12:44:43 +03:00
logger.warning(`We will only automatically build ${language} code. If you wish to scan ${autobuildLanguages
.slice(1)
.join(" and ")}, you must replace this call with custom build steps.`);
}
return language;
}
exports.determineAutobuildLanguage = determineAutobuildLanguage;
async function runAutobuild(language, config, logger) {
2020-08-25 18:19:15 +03:00
logger.startGroup(`Attempting to automatically build ${language} code`);
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
2020-08-25 18:19:15 +03:00
await codeQL.runAutobuild(language);
logger.endGroup();
}
exports.runAutobuild = runAutobuild;
//# sourceMappingURL=autobuild.js.map