Write toolcache marker file

This commit is contained in:
Henry Mercer 2024-12-02 18:30:02 +00:00
parent 028cece17f
commit 0b2048550c
6 changed files with 59 additions and 29 deletions

7
lib/tools-download.js generated
View file

@ -26,6 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.STREAMING_HIGH_WATERMARK_BYTES = void 0;
exports.downloadAndExtract = downloadAndExtract;
exports.getToolcacheDirectory = getToolcacheDirectory;
exports.writeToolcacheMarkerFile = writeToolcacheMarkerFile;
const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks");
@ -114,6 +116,11 @@ async function downloadAndExtractZstdWithStreaming(codeqlURL, dest, authorizatio
function getToolcacheDirectory(version) {
return path.join((0, util_1.getRequiredEnvParam)("RUNNER_TOOL_CACHE"), TOOLCACHE_TOOL_NAME, semver.clean(version) || version, os.arch() || "");
}
function writeToolcacheMarkerFile(extractedPath, logger) {
const markerFilePath = `${extractedPath}.complete`;
fs.writeFileSync(markerFilePath, "");
logger.debug(`Wrote marker file to ${markerFilePath}`);
}
function sanitizeUrlForStatusReport(url) {
return ["github/codeql-action", "dsp-testing/codeql-cli-nightlies"].some((repo) => url.startsWith(`https://github.com/${repo}/releases/download/`))
? url