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.

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

@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

@KSXGitHub KSXGitHub requested review from Copilot and zkochan December 6, 2025 04:23
@KSXGitHub KSXGitHub changed the title Add pnpm store caching feat: store caching Dec 6, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

None yet

Projects

None yet

3 participants