Skip to content
Latchkey

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

.github/workflows/ci.yml
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 test

On 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.

.github/workflows/ci.yml
# 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.2

Key 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.

Frequently asked questions

pnpm/action-setup: Install pnpm in CI?
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.
On any runner?
pnpm setup runs on any runner. Latchkey managed runners run it unchanged.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card