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:
jdx 2026-04-11 14:22:01 +00:00
parent ac93c8a0e0
commit b8f8b694da
No known key found for this signature in database
GPG key ID: 584DADE86724B407
5 changed files with 20 additions and 25 deletions

View file

@ -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}`)