diff --git a/dist/index.js b/dist/index.js index 357c0ba..f63bb58 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/src/pnpm-install/index.ts b/src/pnpm-install/index.ts index 5a09a0d..5ea479b 100644 --- a/src/pnpm-install/index.ts +++ b/src/pnpm-install/index.ts @@ -1,14 +1,10 @@ -import process from 'process' -import path from 'path' import { spawnSync } from 'child_process' import { setFailed } from '@actions/core' import { Inputs } from '../inputs' +import { patchPnpmEnv } from '../utils' export function runPnpmInstall(inputs: Inputs) { - const env = { - ...process.env, - PATH: inputs.binDest + path.delimiter + process.env.PATH - } + const env = patchPnpmEnv(inputs) for (const options of inputs.runInstall) { const args = ['install'] diff --git a/src/pnpm-store-prune/index.ts b/src/pnpm-store-prune/index.ts index cb45e2c..ef93bac 100644 --- a/src/pnpm-store-prune/index.ts +++ b/src/pnpm-store-prune/index.ts @@ -1,6 +1,7 @@ import { spawnSync } from 'child_process' import { setFailed } from '@actions/core' import { Inputs } from '../inputs' +import { patchPnpmEnv } from '../utils' export function pruneStore(inputs: Inputs) { if (inputs.runInstall.length === 0) { @@ -11,6 +12,8 @@ export function pruneStore(inputs: Inputs) { console.log('Running pnpm store prune') const { error, status } = spawnSync('pnpm', ['store', 'prune'], { stdio: 'inherit', + shell: true, + env: patchPnpmEnv(inputs) }) if (error) { diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..c4fad7b --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,8 @@ +import process from 'process' +import path from 'path' +import { Inputs } from '../inputs' + +export const patchPnpmEnv = (inputs: Inputs): NodeJS.ProcessEnv => ({ + ...process.env, + PATH: inputs.binDest + path.delimiter + process.env.PATH +})