[Guides](https://checklane.sh/guides) · Checked on 28 November 2026

# How do I cache pnpm in GitHub Actions?

Cache the pnpm store and keep the install step. [`setup-node`](https://github.com/actions/setup-node#caching-global-packages-data) caches package data rather than `node_modules`; pnpm still has to build the workspace from the lockfile.

## Restore the pnpm store before installing

1.  Commit `pnpm-lock.yaml` and pin the pnpm version your project uses. Follow [pnpm’s CI guidance](https://pnpm.io/continuous-integration) for the install. Restore packages only from a cache you trust.
    
2.  Install pnpm before `setup-node` looks up the store path. Use [the lockfile path](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data) for the cache key and run `pnpm install --frozen-lockfile`.
    

### Tested on 28 November 2026

On checklane-2vcpu, setup-node restored the pnpm store. The frozen install completed and the Node test passed. This small fixture verifies the restore, not how much time a larger repository will save.

Show the workflow YAML

```yaml
name: Reuse the pnpm store
on:
  pull_request:
  workflow_dispatch:
permissions:
  contents: read
jobs:
  install:
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
    runs-on: checklane-2vcpu
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        with:
          node-version: '24.22.3'
          cache: pnpm
          cache-dependency-path: pnpm-lock.yaml
      - run: pnpm install --frozen-lockfile
      - run: pnpm test
```

Compare the whole install on a cold run and a warm run of the same commit. Include restore and save time. [pnpm cautions](https://pnpm.io/continuous-integration) that caching the store doesn’t always make CI faster.

On our own CI, a warm pnpm install took a median of 4 s across 343 PR jobs over eight days (20–28 November 2026 UTC). We timed the install step in GitHub’s jobs API and counted successful installs where the setup-node log confirmed a restored pnpm store, excluding copied rerun results.

Related guide: [How do I speed up GitHub Actions?](https://checklane.sh/guides/speed-up-github-actions)

## Frequently asked questions

### What if pnpm-lock.yaml lives in a subdirectory?

Set cache to pnpm and point setup-node’s cache-dependency-path at the lockfile, for example frontend/pnpm-lock.yaml. The cache key then follows that file rather than looking in the repository root.

[actions/setup-node: caching package data](https://github.com/actions/setup-node)

### Why does Turbo report a cache hit when my dist folder is missing?

Check the build task’s outputs in turbo.json. Turborepo can replay the log on a cache hit, but it only restores files you declared as outputs, such as dist/\*\*.

[Turborepo: task outputs](https://turborepo.dev/docs/crafting-your-repository/caching)

### Does Vercel Remote Cache need a long-lived token in GitHub Actions?

You can use OpenID Connect instead. Configure an OIDC policy on your Vercel team, give the job id-token: write and run Vercel’s remote-cache setup action with TURBO\_TEAM before turbo runs.

[Turborepo: remote caching in GitHub Actions](https://turborepo.dev/docs/guides/ci-vendors/github-actions)

## Run this job on Checklane

On Checklane the [pnpm store is cached automatically](https://checklane.sh/docs/caching/package-folders). Keep the install; remove the explicit store cache if both would save the same directory.

[Connect your repository](https://checklane.sh/docs/moving), then set the job’s runner label:

```
runs-on: checklane
```

---

From https://checklane.sh/guides/github-actions-pnpm-cache
