pnpm/action-setup: Install pnpm in CI
action-setup installs pnpm so your workflow can use it for installs and scripts.
Install pnpm first, then run setup-node with cache: pnpm to cache the store. Or set run_install to install dependencies directly from this action.
Key inputs (with:)
- version: pnpm version to install (or read packageManager).
- run_install: run pnpm install as part of the step.
- dest: where to install the pnpm binary.
- standalone: install a standalone pnpm.
Example workflow
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm testOn any runner
pnpm setup runs on any runner. Latchkey managed runners run it unchanged.
Pinning and supply-chain hygiene
A third-party action runs arbitrary code with access to your workflow token. Version tags are mutable, so @v4 can change under you without any commit in your repository.
# mutable: the tag can be repointed at any time
- uses: some/action@v4
# immutable: pin to the commit SHA, with the version in a comment
- uses: some/action@e2b3f4a5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1 # v4.1.2Key takeaways
- Install pnpm before calling setup-node with cache: pnpm.
- Order matters: setup-node needs pnpm on PATH to cache it.
- Use --frozen-lockfile in CI for deterministic installs.