mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-10-18 16:46:58 +00:00
Warn when UV_CACHE_DIR
has changed (#601)
Closes https://github.com/astral-sh/setup-uv/issues/592
This commit is contained in:
13
dist/save-cache/index.js
generated
vendored
13
dist/save-cache/index.js
generated
vendored
@@ -90056,12 +90056,17 @@ async function saveCache() {
|
|||||||
if (inputs_1.pruneCache) {
|
if (inputs_1.pruneCache) {
|
||||||
await pruneCache();
|
await pruneCache();
|
||||||
}
|
}
|
||||||
core.info(`Saving cache path: ${inputs_1.cacheLocalPath}`);
|
let actualCachePath = inputs_1.cacheLocalPath;
|
||||||
if (!fs.existsSync(inputs_1.cacheLocalPath) && !inputs_1.ignoreNothingToCache) {
|
if (process.env.UV_CACHE_DIR && process.env.UV_CACHE_DIR !== inputs_1.cacheLocalPath) {
|
||||||
throw new Error(`Cache path ${inputs_1.cacheLocalPath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`);
|
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 "${inputs_1.cacheLocalPath}".`);
|
||||||
|
actualCachePath = process.env.UV_CACHE_DIR;
|
||||||
|
}
|
||||||
|
core.info(`Saving cache path: ${actualCachePath}`);
|
||||||
|
if (!fs.existsSync(actualCachePath) && !inputs_1.ignoreNothingToCache) {
|
||||||
|
throw new Error(`Cache path ${actualCachePath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await cache.saveCache([inputs_1.cacheLocalPath], cacheKey);
|
await cache.saveCache([actualCachePath], cacheKey);
|
||||||
core.info(`cache saved with the key: ${cacheKey}`);
|
core.info(`cache saved with the key: ${cacheKey}`);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
@@ -52,14 +52,22 @@ async function saveCache(): Promise<void> {
|
|||||||
await pruneCache();
|
await pruneCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`Saving cache path: ${cacheLocalPath}`);
|
let actualCachePath = cacheLocalPath;
|
||||||
if (!fs.existsSync(cacheLocalPath) && !ignoreNothingToCache) {
|
if (process.env.UV_CACHE_DIR && process.env.UV_CACHE_DIR !== cacheLocalPath) {
|
||||||
|
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}".`,
|
||||||
|
);
|
||||||
|
actualCachePath = process.env.UV_CACHE_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info(`Saving cache path: ${actualCachePath}`);
|
||||||
|
if (!fs.existsSync(actualCachePath) && !ignoreNothingToCache) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Cache path ${cacheLocalPath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`,
|
`Cache path ${actualCachePath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await cache.saveCache([cacheLocalPath], cacheKey);
|
await cache.saveCache([actualCachePath], cacheKey);
|
||||||
core.info(`cache saved with the key: ${cacheKey}`);
|
core.info(`cache saved with the key: ${cacheKey}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
|
Reference in New Issue
Block a user