mirror of
https://github.com/github/codeql-action.git
synced 2025-12-23 15:50:11 +08:00
54 lines
2.7 KiB
JavaScript
Generated
54 lines
2.7 KiB
JavaScript
Generated
"use strict";
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.runAutobuild = exports.determineAutobuildLanguage = void 0;
|
|
const codeql_1 = require("./codeql");
|
|
const languages_1 = require("./languages");
|
|
const util = __importStar(require("./util"));
|
|
async function determineAutobuildLanguage(config, featureFlags, logger) {
|
|
const isGoExtractionReconciliationEnabled = await util.isGoExtractionReconciliationEnabled(featureFlags);
|
|
// 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, isGoExtractionReconciliationEnabled, logger));
|
|
const language = autobuildLanguages[0];
|
|
if (!language) {
|
|
logger.info("None of the languages in this project require extra build steps");
|
|
return undefined;
|
|
}
|
|
logger.debug(`Detected dominant traced language: ${language}`);
|
|
if (autobuildLanguages.length > 1) {
|
|
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) {
|
|
logger.startGroup(`Attempting to automatically build ${language} code`);
|
|
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
|
await codeQL.runAutobuild(language);
|
|
logger.endGroup();
|
|
}
|
|
exports.runAutobuild = runAutobuild;
|
|
//# sourceMappingURL=autobuild.js.map
|