Skip to content

Conversation

@jrmajor
Copy link

@jrmajor jrmajor commented Nov 2, 2025

pnpm can install Node runtime as a dependency, but actions/setup-node is still needed to cache the pnpm store (as currently suggested in the readme). Alternative is to add something like this to your workflow:

- name: Get pnpm store directory path
  id: pnpm-cache-dir
  run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Cache pnpm dependencies
  uses: actions/cache@v4
  with:
    path: ${{ steps.pnpm-cache-dir.outputs.dir }}
    key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
    restore-keys: pnpm-

With this PR, the same can be accomplished simply by setting cache: true in setup pnpm action:

- name: Setup pnpm
  uses: pnpm/action-setup@v4
  with:
    cache: true

The implementation is based on actions/setup-node.

Closes #70, closes #80, closes #82, closes #152, closes #173, closes #185.

Once stable, this could be enabled by default, although I think it would require a major version bump.

@oBusk
Copy link

oBusk commented Nov 2, 2025

Would also close #185

@oBusk oBusk mentioned this pull request Nov 2, 2025
@jrmajor
Copy link
Author

jrmajor commented Nov 3, 2025

Thanks @oBusk, linked that issue too.

@jrmajor
Copy link
Author

jrmajor commented Nov 3, 2025

If you would like to test this in your workflows, you can use the hash of the latest commit from this branch as a version:

- name: Setup pnpm
  # https://github.com/pnpm/action-setup/pull/188
  uses: pnpm/action-setup@0bc9da32cd356746083d9e2b8848bad8b974c72c
  with:
    cache: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants