mirror of
https://code.forgejo.org/pnpm/action-setup.git
synced 2025-05-18 12:34:46 +00:00
The pnpm home directory should be added to PATH and PNPM_HOME
This change is needed to make the action compatible with pnpm v7. Related breaking change in pnpm: pnpm/pnpm#4280
This commit is contained in:
parent
15569a497d
commit
6ff6e97bc6
4 changed files with 497 additions and 512 deletions
|
@ -1,3 +1,4 @@
|
|||
import * as core from '@actions/core'
|
||||
import { spawn } from 'child_process'
|
||||
import { execPath } from 'process'
|
||||
import { join } from 'path'
|
||||
|
@ -22,10 +23,19 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
|||
const response = await fetch('https://pnpm.js.org/pnpm.js')
|
||||
response.body.pipe(cp.stdin)
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const exitCode = await new Promise<number>((resolve, reject) => {
|
||||
cp.on('error', reject)
|
||||
cp.on('close', resolve)
|
||||
})
|
||||
if (exitCode === 0) {
|
||||
const pnpmHome = join(dest, 'node_modules/.bin')
|
||||
core.addPath(pnpmHome)
|
||||
// This environment variable will be available in future steps as PNPM_HOME
|
||||
// It is written as PNPM_HOME_PATH due to a convention in GitHub actions:
|
||||
// > Any new environment variables you set that point to a location on the filesystem should have a _PATH suffix.
|
||||
core.exportVariable('PNPM_HOME_PATH', pnpmHome)
|
||||
}
|
||||
return exitCode
|
||||
}
|
||||
|
||||
export default runSelfInstaller
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue