From 832b4cc483080482f4d8dfb96f6b4248140c5372 Mon Sep 17 00:00:00 2001 From: James Braza Date: Wed, 1 Oct 2025 12:48:52 -0700 Subject: [PATCH] Removed check for unset UV_CACHE_DIR per PR comment --- src/save-cache.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/save-cache.ts b/src/save-cache.ts index fa1f7e6..a89815d 100644 --- a/src/save-cache.ts +++ b/src/save-cache.ts @@ -55,16 +55,13 @@ async function saveCache(): Promise { // Check if UV_CACHE_DIR has been changed externally from this action let actualCachePath = cacheLocalPath; if (process.env.UV_CACHE_DIR !== cacheLocalPath) { - if (process.env.UV_CACHE_DIR) { - 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; - } else { - core.warning( - `The environment variable UV_CACHE_DIR has been unset, by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen unset cache-local-path input from "${cacheLocalPath}".` - ); - } + // Don't need to check for unset UV_CACHE_DIR because: + // 1. We set the UV_CACHE_DIR earlier on in this action + // 2. Once an environment variable is set in GitHub Actions, it cannot be unset. + 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}`);