Merge branch 'aeisenberg/unrevert-query-filters' into aeisenberg/fix-config-files

This commit is contained in:
Andrew Eisenberg 2022-08-11 14:16:50 -07:00
commit fa2bc211fd
61 changed files with 882 additions and 112 deletions

13
lib/util.js generated
View file

@ -33,6 +33,7 @@ const api = __importStar(require("./api-client"));
const api_client_1 = require("./api-client");
const apiCompatibility = __importStar(require("./api-compatibility.json"));
const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils");
/**
* Specifies bundle versions that are known to be broken
* and will not be used if found in the toolcache.
@ -564,7 +565,10 @@ async function getMlPoweredJsQueriesPack(codeQL) {
else {
version = `~0.1.0`;
}
return `${exports.ML_POWERED_JS_QUERIES_PACK_NAME}@${version}`;
return (0, config_utils_1.prettyPrintPack)({
name: exports.ML_POWERED_JS_QUERIES_PACK_NAME,
version,
});
}
exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;
/**
@ -590,9 +594,8 @@ exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;
*/
function getMlPoweredJsQueriesStatus(config) {
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
.map((pack) => pack.split("@"))
.filter((packNameVersion) => packNameVersion[0] === "codeql/javascript-experimental-atm-queries" &&
packNameVersion.length <= 2);
.map((p) => (0, config_utils_1.parsePacksSpecification)(p))
.filter((pack) => pack.name === "codeql/javascript-experimental-atm-queries" && !pack.path);
switch (mlPoweredJsQueryPacks.length) {
case 1:
// We should always specify an explicit version string in `getMlPoweredJsQueriesPack`,
@ -600,7 +603,7 @@ function getMlPoweredJsQueriesStatus(config) {
// with each version of the CodeQL Action. Therefore in practice we should only hit the
// `latest` case here when customers have explicitly added the ML-powered query pack to their
// CodeQL config.
return mlPoweredJsQueryPacks[0][1] || "latest";
return mlPoweredJsQueryPacks[0].version || "latest";
case 0:
return "false";
default: