diff --git a/lib/entry-points.js b/lib/entry-points.js index 8aa62b936..60227987f 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -146256,9 +146256,13 @@ function cacheCodeQlVersion(cmd, version, env) { throw new Error("cacheCodeQlVersion() should be called only once"); } cachedCodeQlVersion = version; + const outputCache = { + cmd, + entries: { ["version" /* Version */]: version } + }; fs3.writeFileSync( getCommandCacheFilePath(env), - JSON.stringify({ cmd, entries: { ["version" /* Version */]: version } }), + JSON.stringify(outputCache), "utf8" ); } diff --git a/src/cli/output-cache.ts b/src/cli/output-cache.ts index 88fd612b2..05889a59e 100644 --- a/src/cli/output-cache.ts +++ b/src/cli/output-cache.ts @@ -25,7 +25,9 @@ export type CommandCacheKeyOutputMap = { */ export interface OutputCache { cmd: string; - entries: Map; + entries: { + [P in K]: CommandCacheKeyOutputMap[K]; + }; } /** @@ -70,13 +72,17 @@ export function cacheCodeQlVersion( throw new Error("cacheCodeQlVersion() should be called only once"); } cachedCodeQlVersion = version; + const outputCache = { + cmd, + entries: { [CommandCacheKey.Version]: version }, + } satisfies OutputCache; // Persist the version so that subsequent Actions steps, which run in separate // processes, can reuse it rather than invoking `codeql version` again. We // record the CLI path so that a different step using a different CodeQL bundle // doesn't pick up a stale version. fs.writeFileSync( getCommandCacheFilePath(env), - JSON.stringify({ cmd, entries: { [CommandCacheKey.Version]: version } }), + JSON.stringify(outputCache), "utf8", ); }