Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
00884bc
docs: use cached pnpm installation (#128)
benmccann Jun 12, 2024
562dbbf
fix: correct typo in error message (#125)
benmccann Jun 12, 2024
5d79380
fix: add missing `outputs` metadata to action.yml (#127)
rhysd Jun 12, 2024
23657c8
docs: change order of setup node and pnpm (#129)
hyesungoh Jun 16, 2024
0eb0e97
Add readme example for omitting `version` (#134)
karlhorky Jul 4, 2024
0d0b432
docs: add warning about v2
zkochan Jul 5, 2024
18ac635
docs: remove redundant manual cache due to setup-node cache (#131)
its-monotype Jul 5, 2024
ac5bf11
Update examples to use pnpm v9 (#142)
karlhorky Aug 14, 2024
e303250
docs: update pnpm version in readme examples (#154)
azat-io Jan 8, 2025
0cb0538
feat: support `package.yaml` (#156)
danielbayley Feb 6, 2025
6e3017a
docs: support `package.yaml` (#157)
danielbayley Feb 6, 2025
fff7088
test: update pnpm to v9
zkochan Feb 6, 2025
a7487c7
feat: update dist
zkochan Feb 6, 2025
d648c2d
fix: not allow install multiple package manager (#161)
BlackHole1 Mar 28, 2025
77504a5
Fix multiline run_install example in README.md (#167)
ts-web Jun 25, 2025
f2b2b23
Remove --frozen-lockfile from examples (#171)
ts-web Jul 10, 2025
41ff726
feat: support installation from custom NPM registry (#179)
Eynorey Oct 8, 2025
72f0451
Update README.md (#175)
dreyks Dec 5, 2025
3a0024f
Remove unused `@types/node-fetch` dependency (#186)
silverwind Dec 5, 2025
ee7b871
Clarify that package_json_file is relative to GITHUB_WORKSPACE (#184)
chris-martin Dec 7, 2025
e94b270
feat: store caching (#188)
jrmajor Dec 7, 2025
61bc82c
refactor: remove star imports (#196)
KSXGitHub Dec 10, 2025
b9e1dbc
fix(ci): exclude macos (#197)
KSXGitHub Dec 10, 2025
1e1c8ea
ci: pin github actions (#199)
Boosted-Bonobo Dec 15, 2025
9b5745c
feat!: run the action on Node.js 24 (#205)
zkochan Feb 17, 2026
b906aff
Revert "feat!: run the action on Node.js 24 (#205)"
zkochan Mar 11, 2026
2cb79ab
BB-3615 Upgrade to pnpm 11 and add security settings
AlexArchiPro May 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ jobs:
fail-fast: false
matrix:
pnpm:
- 4.11.1
- 9.15.5
os:
- ubuntu-latest
- macos-latest
- windows-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Run the action
uses: ./
with:
version: 4.11.1
version: 9.15.5

- name: 'Test: which'
run: which pnpm; which pnpx
Expand All @@ -44,19 +44,19 @@ jobs:
fail-fast: false
matrix:
pnpm:
- 4.11.1
- 9.15.5
os:
- ubuntu-latest
- macos-latest
- windows-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Run the action
uses: ./
with:
version: 4.11.1
version: 9.15.5
dest: ~/test/pnpm

- name: 'Test: which'
Expand All @@ -74,25 +74,25 @@ jobs:
fail-fast: false
matrix:
os:
# macos is excluded from this test because node 12 is no longer available on this platform
- ubuntu-latest
- macos-latest
- windows-latest

standalone:
- true
- false

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Run the action
uses: ./
with:
version: 7.0.0
version: 9.15.0
standalone: ${{ matrix.standalone }}

- name: install Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
# pnpm@7.0.0 is not compatible with Node.js 12
node-version: 12.22.12
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
fail-fast: false
matrix:
pnpm:
- 4.11.1
- 9.15.5
os:
- ubuntu-latest
- macos-latest
Expand All @@ -149,7 +149,6 @@ jobs:
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
- name: 'array'
value: |
- {}
Expand All @@ -159,15 +158,14 @@ jobs:
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Run the action
uses: ./
with:
version: 4.11.1
version: 9.15.5
run_install: ${{ matrix.run_install.value }}

- name: 'Test: which'
Expand Down
65 changes: 39 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
> ## :warning: Upgrade from v2!
>
> The v2 version of this action [has stopped working](https://github.com/pnpm/action-setup/issues/135) with newer Node.js versions. Please, upgrade to the latest version to fix any issues.

# Setup pnpm

Install pnpm package manager.
Expand Down Expand Up @@ -36,11 +40,19 @@ If `run_install` is a YAML string representation of either an object or an array

#### `run_install.args`

**Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--frozen-lockfile, --strict-peer-dependencies]`.
**Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--ignore-scripts, --strict-peer-dependencies]`.

### `cache`

**Optional** (_type:_ `boolean`, _default:_ `false`) Whether to cache the pnpm store directory.

### `cache_dependency_path`

**Optional** (_type:_ `string|string[]`, _default:_ `pnpm-lock.yaml`) File path to the pnpm lockfile, which contents hash will be used as a cache key.

### `package_json_file`

**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json` to read "packageManager" configuration.
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json`/[`package.yaml`](https://github.com/pnpm/pnpm/pull/1799) to read "packageManager" configuration.

### `standalone`

Expand All @@ -60,7 +72,9 @@ Location of `pnpm` and `pnpx` command.

## Usage example

### Just install pnpm
### Install only pnpm without `packageManager`

This works when the repo either doesn't have a `package.json` or has a `package.json` but it doesn't specify `packageManager`.

```yaml
on:
Expand All @@ -74,7 +88,24 @@ jobs:
steps:
- uses: pnpm/action-setup@v4
with:
version: 8
version: 10
```

### Install only pnpm with `packageManager`

Omit `version` input to use the version in the [`packageManager` field in the `package.json`](https://nodejs.org/api/corepack.html).

```yaml
on:
- push
- pull_request

jobs:
install:
runs-on: ubuntu-latest

steps:
- uses: pnpm/action-setup@v4
```

### Install pnpm and a few npm packages
Expand All @@ -93,10 +124,10 @@ jobs:

- uses: pnpm/action-setup@v4
with:
version: 8
version: 10
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
args: [--strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript]
```

Expand All @@ -115,29 +146,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
version: 10
cache: true

- name: Install dependencies
run: pnpm install
Expand Down
15 changes: 14 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,27 @@ inputs:
description: If specified, run `pnpm install`
required: false
default: 'null'
cache:
description: Whether to cache the pnpm store directory
required: false
default: 'false'
cache_dependency_path:
description: File path to the pnpm lockfile, which contents hash will be used as a cache key
required: false
default: 'pnpm-lock.yaml'
package_json_file:
description: File path to the package.json to read "packageManager" configuration
description: File path to the package.json to read "packageManager" configuration. This path must be relative to the repository root (GITHUB_WORKSPACE).
required: false
default: 'package.json'
standalone:
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed, enabling using pnpm without Node.js.
required: false
default: 'false'
outputs:
dest:
description: Expanded path of inputs#dest
bin_dest:
description: Location of `pnpm` and `pnpx` command
runs:
using: node20
main: dist/index.js
Expand Down
8 changes: 4 additions & 4 deletions dist/index.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
"update-pnpm-dist": "pnpm install && cp ./node_modules/pnpm/dist/pnpm.cjs ./dist/pnpm.cjs && cp ./node_modules/pnpm/dist/worker.js ./dist/worker.js"
},
"dependencies": {
"@actions/cache": "^4.1.0",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/glob": "^0.5.0",
"@types/expand-tilde": "^2.0.2",
"@types/node": "^20.11.5",
"@types/node-fetch": "^2.6.11",
"expand-tilde": "^2.0.2",
"yaml": "^2.3.4",
"zod": "^3.22.4"
Expand Down
Loading
Loading