mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-16 14:40:33 +00:00
fix: use workspace-local mise dir on Windows for cache compatibility
@actions/cache uses @actions/glob internally to resolve cache paths, which fails when the path is on a different drive than GITHUB_WORKSPACE. On Windows CI runners, GITHUB_WORKSPACE is typically on D: while LOCALAPPDATA (the previous default) is on C:, causing saveCache to throw "Path Validation Error" on cold caches. Default to GITHUB_WORKSPACE/.mise on Windows so the cache path is always on the same drive as the workspace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ac93c8a0e0
commit
b8f8b694da
5 changed files with 20 additions and 25 deletions
|
|
@ -399,6 +399,7 @@ function miseDir(): string {
|
|||
const { MISE_DATA_DIR, XDG_DATA_HOME, LOCALAPPDATA } = process.env
|
||||
if (MISE_DATA_DIR) return MISE_DATA_DIR
|
||||
if (XDG_DATA_HOME) return path.join(XDG_DATA_HOME, 'mise')
|
||||
|
||||
if (process.platform === 'win32' && LOCALAPPDATA)
|
||||
return path.join(LOCALAPPDATA, 'mise')
|
||||
|
||||
|
|
@ -408,6 +409,14 @@ function miseDir(): string {
|
|||
async function saveCache(cacheKey: string): Promise<void> {
|
||||
await core.group(`Saving mise cache`, async () => {
|
||||
const cachePath = miseDir()
|
||||
core.info(`Cache path: ${cachePath}`)
|
||||
core.info(`Cache path exists: ${fs.existsSync(cachePath)}`)
|
||||
core.info(`Platform: ${process.platform}`)
|
||||
core.info(`GITHUB_WORKSPACE: ${process.env.GITHUB_WORKSPACE}`)
|
||||
if (fs.existsSync(cachePath)) {
|
||||
const contents = await fs.promises.readdir(cachePath)
|
||||
core.info(`Cache dir contents: ${JSON.stringify(contents)}`)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(cachePath)) {
|
||||
throw new Error(`Cache folder path does not exist on disk: ${cachePath}`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue