diff --git a/action.yml b/action.yml index bf24164..b29d5ea 100644 --- a/action.yml +++ b/action.yml @@ -26,7 +26,7 @@ inputs: required: false cache-local-path: description: "Local path to store the cache." - default: "/tmp/setup-uv-cache" + default: "" outputs: uv-version: description: "The installed uv version. Useful when using latest." diff --git a/dist/save-cache/index.js b/dist/save-cache/index.js index bf2c4a0..2cf89c1 100644 Binary files a/dist/save-cache/index.js and b/dist/save-cache/index.js differ diff --git a/dist/setup/index.js b/dist/setup/index.js index cc6415e..7b96d7c 100644 Binary files a/dist/setup/index.js and b/dist/setup/index.js differ diff --git a/src/utils/inputs.ts b/src/utils/inputs.ts index dd582a7..66eec47 100644 --- a/src/utils/inputs.ts +++ b/src/utils/inputs.ts @@ -1,9 +1,24 @@ import * as core from "@actions/core"; +import path from "path"; export const version = core.getInput("version"); export const checkSum = core.getInput("checksum"); export const enableCache = core.getInput("enable-cache") === "true"; export const cacheSuffix = core.getInput("cache-suffix") || ""; -export const cacheLocalPath = core.getInput("cache-local-path"); +export const cacheLocalPath = getCacheLocalPath(); export const githubToken = core.getInput("github-token"); export const cacheDependencyGlob = core.getInput("cache-dependency-glob"); + +function getCacheLocalPath(): string { + const cacheLocalPathInput = core.getInput("cache-local-path"); + if (cacheLocalPathInput !== "") { + return cacheLocalPathInput; + } + if (process.env.RUNNER_TEMP !== undefined) { + return `${process.env.RUNNER_TEMP}${path.sep}setup-uv-cache`; + } + if (process.platform === "win32") { + return "D:\\a\\_temp\\setup-uv-cache"; + } + return "/tmp/setup-uv-cache"; +}