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:
Zoltan Kochan 2022-02-07 23:15:44 +02:00
parent 15569a497d
commit 6ff6e97bc6
No known key found for this signature in database
GPG Key ID: 649E4D4AF74E7DEC
4 changed files with 496 additions and 511 deletions

BIN
dist/index.js vendored

Binary file not shown.

View File

@ -7,21 +7,21 @@
"start": "pnpm run build && sh ./run.sh"
},
"dependencies": {
"node-fetch": "^2.6.1",
"expand-tilde": "^2.0.2",
"js-yaml": "^4.0.0",
"ajv": "^6.12.5",
"fs-extra": "^9.1.0",
"@actions/core": "^1.2.6",
"@actions/core": "^1.6.0",
"@types/expand-tilde": "^2.0.0",
"@types/node-fetch": "^2.5.8",
"@types/js-yaml": "^4.0.0",
"@types/fs-extra": "^9.0.8",
"@types/node": "^14.14.35"
"@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.5",
"@types/node": "^14.18.10",
"@types/node-fetch": "^2.5.12",
"ajv": "^6.12.6",
"expand-tilde": "^2.0.2",
"fs-extra": "^9.1.0",
"js-yaml": "^4.1.0",
"node-fetch": "^2.6.7"
},
"devDependencies": {
"typescript": "^4.2.3",
"@ts-schema-autogen/cli": "^0.1.2",
"@vercel/ncc": "^0.27.0"
"@vercel/ncc": "^0.27.0",
"typescript": "^4.5.5"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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