mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Isolate per-language bundle eligibility state
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
48
lib/entry-points.js
generated
48
lib/entry-points.js
generated
@@ -151525,7 +151525,11 @@ var PER_LANGUAGE_BUNDLE_PLATFORMS = {
|
||||
["rust" /* rust */]: "linux64",
|
||||
["swift" /* swift */]: "osx64"
|
||||
};
|
||||
async function getPerLanguageBundleLanguage(options, features, logger) {
|
||||
async function getPerLanguageBundleLanguage({
|
||||
env,
|
||||
features,
|
||||
logger
|
||||
}, options) {
|
||||
const {
|
||||
rawLanguages,
|
||||
cliVersion: cliVersion2,
|
||||
@@ -151538,6 +151542,9 @@ async function getPerLanguageBundleLanguage(options, features, logger) {
|
||||
logger.debug(`Not using a per-language CodeQL bundle since ${reason}.`);
|
||||
return void 0;
|
||||
};
|
||||
if (!await features.getValue("per_language_bundles" /* PerLanguageBundles */)) {
|
||||
return explain(`the ${"per_language_bundles" /* PerLanguageBundles */} feature is disabled`);
|
||||
}
|
||||
if (rawLanguages?.length !== 1) {
|
||||
return explain(
|
||||
`exactly one language must be requested via the 'languages' input, but ${rawLanguages?.length ?? 0} were`
|
||||
@@ -151553,7 +151560,7 @@ async function getPerLanguageBundleLanguage(options, features, logger) {
|
||||
if (variant !== "GitHub.com" /* DOTCOM */) {
|
||||
return explain(`we are running against ${variant}`);
|
||||
}
|
||||
if (!isGitHubHostedRunner()) {
|
||||
if (!isGitHubHostedRunner(env)) {
|
||||
return explain("the job is not running on a GitHub-hosted runner");
|
||||
}
|
||||
if (!isNightly) {
|
||||
@@ -151575,9 +151582,6 @@ async function getPerLanguageBundleLanguage(options, features, logger) {
|
||||
`the ${language} bundle is only published for ${supportedPlatform}, but this job is running on ${platform2 ?? "an unknown platform"}`
|
||||
);
|
||||
}
|
||||
if (!await features.getValue("per_language_bundles" /* PerLanguageBundles */)) {
|
||||
return explain(`the ${"per_language_bundles" /* PerLanguageBundles */} feature is disabled`);
|
||||
}
|
||||
return language;
|
||||
}
|
||||
|
||||
@@ -152254,7 +152258,11 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, rawLanguages, useO
|
||||
`Using the latest CodeQL CLI nightly, as requested by 'tools: ${toolsInput}'.`
|
||||
);
|
||||
}
|
||||
bundle = await getNightlyBundle(rawLanguages, variant, features, logger);
|
||||
bundle = await getNightlyBundle(
|
||||
{ env: getEnv(), features, logger },
|
||||
rawLanguages,
|
||||
variant
|
||||
);
|
||||
toolsInput = bundle.url;
|
||||
}
|
||||
const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput);
|
||||
@@ -152410,15 +152418,14 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, rawLanguages, useO
|
||||
if (!url2) {
|
||||
compressionMethod = cliVersion2 !== void 0 && await useZstdBundle(cliVersion2, tarSupportsZstd) ? "zstd" : "gzip";
|
||||
const perLanguageBundleLanguage = await getPerLanguageBundleLanguage(
|
||||
{ env: getEnv(), features, logger },
|
||||
{
|
||||
rawLanguages,
|
||||
cliVersion: cliVersion2,
|
||||
compressionMethod,
|
||||
platform: getBundlePlatform(),
|
||||
variant
|
||||
},
|
||||
features,
|
||||
logger
|
||||
}
|
||||
);
|
||||
const resolveBundleURL = (language) => getCodeQLBundleDownloadURL(
|
||||
tagName,
|
||||
@@ -152685,24 +152692,21 @@ async function useZstdBundle(cliVersion2, tarSupportsZstd) {
|
||||
function getTempExtractionDir(tempDir) {
|
||||
return path13.join(tempDir, v4_default());
|
||||
}
|
||||
async function getNightlyBundle(rawLanguages, variant, features, logger) {
|
||||
async function getNightlyBundle(action, rawLanguages, variant) {
|
||||
const { logger } = action;
|
||||
const zstdAvailability = await isZstdAvailable(logger);
|
||||
const compressionMethod = await useZstdBundle(
|
||||
CODEQL_VERSION_ZSTD_BUNDLE,
|
||||
zstdAvailability.available
|
||||
) ? "zstd" : "gzip";
|
||||
const language = await getPerLanguageBundleLanguage(
|
||||
{
|
||||
rawLanguages,
|
||||
cliVersion: void 0,
|
||||
compressionMethod,
|
||||
platform: getBundlePlatform(),
|
||||
variant,
|
||||
isNightly: true
|
||||
},
|
||||
features,
|
||||
logger
|
||||
);
|
||||
const language = await getPerLanguageBundleLanguage(action, {
|
||||
rawLanguages,
|
||||
cliVersion: void 0,
|
||||
compressionMethod,
|
||||
platform: getBundlePlatform(),
|
||||
variant,
|
||||
isNightly: true
|
||||
});
|
||||
try {
|
||||
const release2 = await getApiClient().rest.repos.listReleases({
|
||||
owner: CODEQL_NIGHTLIES_REPOSITORY_OWNER,
|
||||
|
||||
Reference in New Issue
Block a user