Skip to content

Correctly sets up node, pnpm, and cache for fastest possible pnpm installations

License

Notifications You must be signed in to change notification settings

wyvox/action-setup-pnpm

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

wyvox/action-setup-pnpm

Correctly sets up node, pnpm, and cache for pnpm dependencies so that installation can be as fast as it can be.

Usage:

steps:
  - uses: actions/checkout@v3
  - uses: wyvox/action-setup-pnpm@v3

Support:

  • dependency cache
  • pnpm only
    • choose pnpm version via package.json#packageManager or package.json#volta.pnpm
    • pass any args

Options

While this action is meant to reduce boilerplate, you end up having one extra line than optimal if you need to customize anything, unless doing inline yaml-object syntax -- example:

- uses: wyvox/action-setup-pnpm@v3
  with: { node-version: 18 }

node-version

Allows changing the node-version passed to actions/setup-node.

- uses: wyvox/action-setup-pnpm@v3
  with:
    node-version: 18

node-version-file

Allows changing the node-version-file passed to actions/setup-node.

The default has changed from actions/setup-node's '' to 'package.json', enabling easy volta usage with 0 configuration for consumers of wyvox/action-setup-pnpm. not providing a volta config also have 0 consequence.

- uses: wyvox/action-setup-pnpm@v3
  with:
    node-version-file: '.node-version'

node-registry-url

Allows changing the registry-url passed to actions/setup-node.

- uses: wyvox/action-setup-pnpm@v3
  with:
    node-registry-url: "https://registry.npmjs.org"

pnpm-version

Allows changing the pnpm-version passed to pnpm/action-setup.

- uses: wyvox/action-setup-pnpm@v1
  with:
    pnpm-version: 7.29.0

args

Passes through any args directly to pnpm install.

- uses: wyvox/action-setup-pnpm@v3
  with:
    args: '--ignore-scripts --fix-lockfile'

Why?

pnpm/action-setup can install dependencies on its own, but then no cache is used from actions/setup-node.

actions/setup-node configures node, (and correctly respects volta configurations), cache, etc

To set this up on your own, you would required three manual steps in your workflow config file:

steps:
  # ...
  - uses: pnpm/action-setup@v2
    with:
      version: 8
  - uses: actions/setup-node@v4
    with:
      cache: 'pnpm'
  - run: pnpm install

About

Correctly sets up node, pnpm, and cache for fastest possible pnpm installations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •