5
0
mirror of https://github.com/astral-sh/setup-uv.git synced 2025-12-27 11:04:43 +00:00

allow cache-local-path w/o enable-cache (#707)

Fixes: #705
This commit is contained in:
Kevin Stillhammer
2025-12-07 17:52:54 +01:00
committed by GitHub
parent 0439606c8e
commit 4180991cd9
8 changed files with 172 additions and 59 deletions

View File

@@ -59,10 +59,18 @@ async function saveCache(): Promise<void> {
await pruneCache();
}
let actualCachePath = cacheLocalPath;
if (process.env.UV_CACHE_DIR && process.env.UV_CACHE_DIR !== cacheLocalPath) {
if (cacheLocalPath === undefined) {
throw new Error(
"cache-local-path is not set. Cannot save cache without a valid cache path.",
);
}
let actualCachePath = cacheLocalPath.path;
if (
process.env.UV_CACHE_DIR &&
process.env.UV_CACHE_DIR !== cacheLocalPath.path
) {
core.warning(
`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${cacheLocalPath}".`,
`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${cacheLocalPath.path}".`,
);
actualCachePath = process.env.UV_CACHE_DIR;
}