mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-09-21 19:36:42 +00:00
committed by
GitHub
parent
f67343ac2e
commit
dc724a12b6
9
src/cache/restore-cache.ts
vendored
9
src/cache/restore-cache.ts
vendored
@ -8,6 +8,7 @@ import {
|
||||
cacheSuffix,
|
||||
pruneCache,
|
||||
pythonVersion as pythonVersionInput,
|
||||
restoreCache as shouldRestoreCache,
|
||||
workingDirectory,
|
||||
} from "../utils/inputs";
|
||||
import { getArch, getPlatform } from "../utils/platforms";
|
||||
@ -18,6 +19,12 @@ const CACHE_VERSION = "1";
|
||||
|
||||
export async function restoreCache(): Promise<void> {
|
||||
const cacheKey = await computeKeys();
|
||||
core.saveState(STATE_CACHE_KEY, cacheKey);
|
||||
|
||||
if (!shouldRestoreCache) {
|
||||
core.info("restore-cache is false. Skipping restore cache step.");
|
||||
return;
|
||||
}
|
||||
|
||||
let matchedKey: string | undefined;
|
||||
core.info(
|
||||
@ -32,8 +39,6 @@ export async function restoreCache(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
core.saveState(STATE_CACHE_KEY, cacheKey);
|
||||
|
||||
handleMatchResult(matchedKey, cacheKey);
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,17 @@ import {
|
||||
enableCache,
|
||||
ignoreNothingToCache,
|
||||
pruneCache as shouldPruneCache,
|
||||
saveCache as shouldSaveCache,
|
||||
} from "./utils/inputs";
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
if (enableCache) {
|
||||
await saveCache();
|
||||
if (shouldSaveCache) {
|
||||
await saveCache();
|
||||
} else {
|
||||
core.info("save-cache is false. Skipping save cache step.");
|
||||
}
|
||||
// node will stay alive if any promises are not resolved,
|
||||
// which is a possibility if HTTP requests are dangling
|
||||
// due to retries or timeouts. We know that if we got here
|
||||
|
@ -8,6 +8,8 @@ export const pythonVersion = core.getInput("python-version");
|
||||
export const activateEnvironment = core.getBooleanInput("activate-environment");
|
||||
export const checkSum = core.getInput("checksum");
|
||||
export const enableCache = getEnableCache();
|
||||
export const restoreCache = core.getInput("restore-cache") === "true";
|
||||
export const saveCache = core.getInput("save-cache") === "true";
|
||||
export const cacheSuffix = core.getInput("cache-suffix") || "";
|
||||
export const cacheLocalPath = getCacheLocalPath();
|
||||
export const cacheDependencyGlob = getCacheDependencyGlob();
|
||||
|
Reference in New Issue
Block a user