mirror of
https://github.com/pnpm/action-setup.git
synced 2026-04-03 10:50:12 +08:00
fix: remove duplicate addPath in setOutputs that shadowed pnpm.exe
setOutputs called addPath(node_modules/.bin) AFTER installPnpm had already added the correct path (@pnpm/exe on Windows). Since GITHUB_PATH entries are prepended, .bin ended up first in PATH, causing PowerShell to find npm's broken shims instead of pnpm.exe.
This commit is contained in:
214
dist/index.js
vendored
214
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
import { addPath, exportVariable } from '@actions/core'
|
||||
import { spawn, spawnSync } from 'child_process'
|
||||
import { spawn } from 'child_process'
|
||||
import { rm, writeFile, mkdir, symlink } from 'fs/promises'
|
||||
import { readFileSync, existsSync } from 'fs'
|
||||
import path from 'path'
|
||||
@@ -60,15 +60,6 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
? path.join(dest, 'node_modules', '@pnpm', 'exe', process.platform === 'win32' ? 'pnpm.exe' : 'pnpm')
|
||||
: path.join(dest, 'node_modules', 'pnpm', 'bin', 'pnpm.mjs')
|
||||
|
||||
// Verify pnpm is callable
|
||||
console.log(`Verifying pnpm at: ${bootstrapPnpm}`)
|
||||
console.log(`File exists: ${existsSync(bootstrapPnpm)}`)
|
||||
const verify = spawnSync(bootstrapPnpm, ['--version'], { encoding: 'utf8', timeout: 15000 })
|
||||
console.log(`pnpm --version stdout: ${JSON.stringify(verify.stdout)}`)
|
||||
console.log(`pnpm --version stderr: ${JSON.stringify(verify.stderr)}`)
|
||||
console.log(`pnpm --version status: ${verify.status}`)
|
||||
if (verify.error) console.log(`pnpm --version error: ${verify.error}`)
|
||||
|
||||
// Determine the target version
|
||||
const targetVersion = readTargetVersion({ version, packageJsonFile })
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { setOutput, addPath } from '@actions/core'
|
||||
import { setOutput } from '@actions/core'
|
||||
import { Inputs } from '../inputs'
|
||||
import { getBinDest } from '../utils'
|
||||
|
||||
export function setOutputs(inputs: Inputs) {
|
||||
const binDest = getBinDest(inputs)
|
||||
addPath(binDest)
|
||||
// NOTE: addPath is already called in installPnpm — do not call it again
|
||||
// here, as a second addPath would shadow the correct entry on Windows.
|
||||
setOutput('dest', inputs.dest)
|
||||
setOutput('bin_dest', binDest)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user