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:
Vendored
+104
-104
File diff suppressed because one or more lines are too long
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user