2
mirror of https://github.com/pnpm/action-setup.git synced 2026-08-13 16:01:31 +00:00

fix: normalize Windows extended-length store paths

On a Windows runner pnpm 12 reports a store path like
`\\?\D:\.pnpm-store\v11`, and the post step then fails with
"Invalid pattern. Root segment must not contain globs" — the cache toolkit
reads the `?` in that prefix as a glob in the root segment. Cache APIs do not
need the extended-length form, so the path is converted back to a regular
drive or UNC path, the same way pnpm/setup handles it.

Reported in pnpm/action-setup#286 and reproduced by the Windows leg of the
lockfile verification cache job.
This commit is contained in:
Zoltan Kochan
2026-08-13 14:05:26 +02:00
parent c0a6b0ff36
commit f141ddd75f
2 changed files with 106 additions and 105 deletions
+104 -104
View File
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -5,6 +5,7 @@ import { hashFiles } from '@actions/glob'
import os from 'os' import os from 'os'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
import { restoreVerificationCache } from '../lockfile-verification-cache' import { restoreVerificationCache } from '../lockfile-verification-cache'
import { removeWindowsExtendedPathPrefix } from '../windows-path'
export async function runRestoreCache(inputs: Inputs) { export async function runRestoreCache(inputs: Inputs) {
const fileHash = await hashFiles(inputs.cacheDependencyPath) const fileHash = await hashFiles(inputs.cacheDependencyPath)
@@ -48,7 +49,7 @@ async function runRestoreStoreCache(fileHash: string) {
async function getCacheDirectory() { async function getCacheDirectory() {
const { stdout } = await getExecOutput('pnpm store path --silent') const { stdout } = await getExecOutput('pnpm store path --silent')
const cacheFolderPath = stdout.trim() const cacheFolderPath = removeWindowsExtendedPathPrefix(stdout.trim())
debug(`Cache folder is set to "${cacheFolderPath}"`) debug(`Cache folder is set to "${cacheFolderPath}"`)
return cacheFolderPath return cacheFolderPath
} }