mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Return toolcache rejection reasons with Result
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
37
lib/entry-points.js
generated
37
lib/entry-points.js
generated
@@ -152541,8 +152541,8 @@ var downloadCodeQL = async function(source, apiDetails, tarVersion, tempDir, log
|
||||
codeqlURL
|
||||
);
|
||||
}
|
||||
const toolcacheDestination = getToolcacheDestination(source, logger);
|
||||
const extractedBundlePath = toolcacheDestination ?? getTempExtractionDir(tempDir);
|
||||
const toolcacheDestination = getToolcacheDestination({ logger }, source);
|
||||
const extractedBundlePath = toolcacheDestination.isSuccess() ? toolcacheDestination.value : getTempExtractionDir(tempDir);
|
||||
const statusReport = await downloadAndExtract(
|
||||
codeqlURL,
|
||||
compressionMethod,
|
||||
@@ -152552,27 +152552,34 @@ var downloadCodeQL = async function(source, apiDetails, tarVersion, tempDir, log
|
||||
tarVersion,
|
||||
logger
|
||||
);
|
||||
if (toolcacheDestination) {
|
||||
writeToolcacheMarkerFile(toolcacheDestination, logger);
|
||||
if (toolcacheDestination.isSuccess()) {
|
||||
writeToolcacheMarkerFile(toolcacheDestination.value, logger);
|
||||
} else {
|
||||
logger.debug(
|
||||
bundle.kind === "per-language" ? "Not caching the CodeQL tools because they came from a bundle that contains only a single language." : `Could not cache CodeQL tools because we could not determine the bundle version from the URL ${codeqlURL}.`
|
||||
);
|
||||
logger.debug(toolcacheDestination.value);
|
||||
}
|
||||
return {
|
||||
codeqlFolder: extractedBundlePath,
|
||||
statusReport: bundle.kind === "per-language" ? { ...statusReport, bundleLanguage: bundle.language } : statusReport
|
||||
};
|
||||
};
|
||||
function getToolcacheDestination(source, logger) {
|
||||
if (source.bundle.kind !== "combined" || !source.bundleVersion) {
|
||||
return void 0;
|
||||
function getToolcacheDestination({ logger }, source) {
|
||||
if (source.bundle.kind !== "combined") {
|
||||
return new Failure(
|
||||
"Not caching the CodeQL tools because they came from a bundle that contains only a single language."
|
||||
);
|
||||
}
|
||||
return getToolcacheDirectory(
|
||||
getCanonicalToolcacheVersion(
|
||||
source.cliVersion,
|
||||
source.bundleVersion,
|
||||
logger
|
||||
if (!source.bundleVersion) {
|
||||
return new Failure(
|
||||
`Could not cache CodeQL tools because we could not determine the bundle version from the URL ${source.bundle.url}.`
|
||||
);
|
||||
}
|
||||
return new Success(
|
||||
getToolcacheDirectory(
|
||||
getCanonicalToolcacheVersion(
|
||||
source.cliVersion,
|
||||
source.bundleVersion,
|
||||
logger
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user