This commit is contained in:
github-actions[bot] 2024-06-25 09:21:42 +00:00
parent 1895b29ac8
commit 9cf3243b0b
59 changed files with 233 additions and 248 deletions

18
lib/setup-codeql.js generated
View file

@ -26,7 +26,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupCodeQLBundle = exports.getCodeQLURLVersion = exports.downloadCodeQL = exports.tryGetFallbackToolcacheVersion = exports.getCodeQLSource = exports.convertToSemVer = exports.tryGetBundleVersionFromUrl = exports.tryFindCliVersionDotcomOnly = exports.getCodeQLActionRepository = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = exports.ToolsSource = void 0;
exports.downloadCodeQL = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = exports.ToolsSource = void 0;
exports.getCodeQLActionRepository = getCodeQLActionRepository;
exports.tryFindCliVersionDotcomOnly = tryFindCliVersionDotcomOnly;
exports.tryGetBundleVersionFromUrl = tryGetBundleVersionFromUrl;
exports.convertToSemVer = convertToSemVer;
exports.getCodeQLSource = getCodeQLSource;
exports.tryGetFallbackToolcacheVersion = tryGetFallbackToolcacheVersion;
exports.getCodeQLURLVersion = getCodeQLURLVersion;
exports.setupCodeQLBundle = setupCodeQLBundle;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks");
@ -79,7 +87,6 @@ function getCodeQLActionRepository(logger) {
}
return util.getRequiredEnvParam("GITHUB_ACTION_REPOSITORY");
}
exports.getCodeQLActionRepository = getCodeQLActionRepository;
function tryGetCodeQLCliVersionForRelease(release, logger) {
const cliVersionsFromMarkerFiles = release.assets
.map((asset) => asset.name.match(/cli-version-(.*)\.txt/)?.[1])
@ -112,7 +119,6 @@ async function tryFindCliVersionDotcomOnly(tagName, logger) {
return undefined;
}
}
exports.tryFindCliVersionDotcomOnly = tryFindCliVersionDotcomOnly;
async function getCodeQLBundleDownloadURL(tagName, apiDetails, logger) {
const codeQLActionRepository = getCodeQLActionRepository(logger);
const potentialDownloadSources = [
@ -179,7 +185,6 @@ function tryGetBundleVersionFromUrl(url, logger) {
}
return tryGetBundleVersionFromTagName(tagName, logger);
}
exports.tryGetBundleVersionFromUrl = tryGetBundleVersionFromUrl;
function convertToSemVer(version, logger) {
if (!semver.valid(version)) {
logger.debug(`Bundle version ${version} is not in SemVer format. Will treat it as pre-release 0.0.0-${version}.`);
@ -191,7 +196,6 @@ function convertToSemVer(version, logger) {
}
return s;
}
exports.convertToSemVer = convertToSemVer;
/**
* Look for a version of the CodeQL tools in the cache which could override the requested CLI version.
*/
@ -380,7 +384,6 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
toolsVersion: cliVersion ?? humanReadableVersion,
};
}
exports.getCodeQLSource = getCodeQLSource;
/**
* Gets a fallback version number to use when looking for CodeQL in the toolcache if we didn't find
* the `x.y.z` version. This is to support old versions of the toolcache.
@ -395,7 +398,6 @@ async function tryGetFallbackToolcacheVersion(cliVersion, tagName, logger) {
`${cliVersion ?? tagName}.`);
return fallbackVersion;
}
exports.tryGetFallbackToolcacheVersion = tryGetFallbackToolcacheVersion;
// Exported using `export const` for testing purposes. Specifically, we want to
// be able to stub this function and have other functions in this file use that stub.
const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVersion, apiDetails, variant, tempDir, logger) {
@ -470,7 +472,6 @@ function getCodeQLURLVersion(url) {
}
return match[1];
}
exports.getCodeQLURLVersion = getCodeQLURLVersion;
/**
* Returns the toolcache version number to use to store the bundle with the associated CLI version
* and bundle version.
@ -540,7 +541,6 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
}
return { codeqlFolder, toolsDownloadDurationMs, toolsSource, toolsVersion };
}
exports.setupCodeQLBundle = setupCodeQLBundle;
async function cleanUpGlob(glob, name, logger) {
logger.debug(`Cleaning up ${name}.`);
try {