mirror of
https://github.com/pnpm/action-setup.git
synced 2026-07-08 17:43:45 +08:00
Compare commits
3 Commits
87e93ca41f
...
fix/add-pn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e9503d0fb | ||
|
|
c753b811d8 | ||
|
|
2e223e0f0d |
28
.github/workflows/pr-check.yaml
vendored
Normal file
28
.github/workflows/pr-check.yaml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: pr-check
|
||||
|
||||
on: [ pull_request ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check-dist:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
|
||||
with:
|
||||
run_install: true
|
||||
version: 9
|
||||
|
||||
- name: Update dist/index.js
|
||||
run: pnpm run build
|
||||
|
||||
- name: Check for uncommitted changes in dist
|
||||
run: git diff --exit-code dist/index.js
|
||||
8
dist/index.js
vendored
8
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,27 +1,16 @@
|
||||
import { setFailed, startGroup, endGroup } from "@actions/core";
|
||||
import { Inputs } from "../inputs";
|
||||
import runSelfInstaller from "./run";
|
||||
import { exec } from "child_process";
|
||||
import { promisify } from "util";
|
||||
import { setFailed, startGroup, endGroup } from '@actions/core'
|
||||
import { Inputs } from '../inputs'
|
||||
import runSelfInstaller from './run'
|
||||
|
||||
export { runSelfInstaller };
|
||||
const execAsync = promisify(exec);
|
||||
export { runSelfInstaller }
|
||||
|
||||
export async function install(inputs: Inputs) {
|
||||
try {
|
||||
await execAsync("pnpm --version");
|
||||
return;
|
||||
} catch {}
|
||||
|
||||
startGroup("Running self-installer...");
|
||||
const status = await runSelfInstaller(inputs);
|
||||
endGroup();
|
||||
|
||||
startGroup('Running self-installer...')
|
||||
const status = await runSelfInstaller(inputs)
|
||||
endGroup()
|
||||
if (status) {
|
||||
return setFailed(
|
||||
`Something went wrong, self-installer exits with code ${status}`,
|
||||
);
|
||||
return setFailed(`Something went wrong, self-installer exits with code ${status}`)
|
||||
}
|
||||
}
|
||||
|
||||
export default install;
|
||||
export default install
|
||||
|
||||
@@ -44,6 +44,7 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
if (exitCode === 0) {
|
||||
const pnpmHome = path.join(dest, 'node_modules/.bin')
|
||||
addPath(pnpmHome)
|
||||
addPath(path.join(pnpmHome, 'bin'))
|
||||
exportVariable('PNPM_HOME', pnpmHome)
|
||||
}
|
||||
return exitCode
|
||||
|
||||
@@ -6,5 +6,5 @@ export const getBinDest = (inputs: Inputs): string => path.join(inputs.dest, 'no
|
||||
|
||||
export const patchPnpmEnv = (inputs: Inputs): NodeJS.ProcessEnv => ({
|
||||
...process.env,
|
||||
PATH: getBinDest(inputs) + path.delimiter + process.env.PATH,
|
||||
PATH: path.join(getBinDest(inputs), 'bin') + path.delimiter + getBinDest(inputs) + path.delimiter + process.env.PATH,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user