fix: add pnpm to PATH

This commit is contained in:
Zoltan Kochan 2022-02-07 03:26:03 +02:00
parent 15569a497d
commit eb99e9e4c7
No known key found for this signature in database
GPG Key ID: 649E4D4AF74E7DEC

View File

@ -1,3 +1,4 @@
import * as core from '@actions/core'
import { spawn } from 'child_process' import { spawn } from 'child_process'
import { execPath } from 'process' import { execPath } from 'process'
import { join } from 'path' import { join } from 'path'
@ -22,10 +23,14 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const response = await fetch('https://pnpm.js.org/pnpm.js') const response = await fetch('https://pnpm.js.org/pnpm.js')
response.body.pipe(cp.stdin) response.body.pipe(cp.stdin)
return new Promise((resolve, reject) => { const result = await new Promise<number>((resolve, reject) => {
cp.on('error', reject) cp.on('error', reject)
cp.on('close', resolve) cp.on('close', resolve)
}) })
if (result === 0) {
core.addPath(join(dest, 'node_modules/.bin'))
}
return result
} }
export default runSelfInstaller export default runSelfInstaller