Skip to content

Commit 1ef1e98

Browse files
committed
fix(github-actions): provide an option to disable pnpm cache
The actions/setup-node step now includes a disable-pnpm-cache input. This resolves an issue where actions/cache would cause the workflow to fail on certain environments, such as WSL, due to being unable to locate the pnpm cache store.
1 parent 98b7d61 commit 1ef1e98

File tree

1 file changed

+6
-2
lines changed
  • github-actions/npm/checkout-and-setup-node

1 file changed

+6
-2
lines changed

github-actions/npm/checkout-and-setup-node/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ inputs:
1717
Relative path to the nvm version file to set node version, exclusive with
1818
node-version-file-path input. Defaults to .nvmrc
1919
20+
disable-package-manager-cache:
21+
description: 'When set to true, disables the package manager cache.'
22+
default: false
23+
2024
runs:
2125
using: composite
2226
steps:
@@ -40,7 +44,7 @@ runs:
4044
PM=$(jq -r '.packageManager | match("^(npm|pnpm|yarn)@").captures[0].string' package.json || echo "")
4145
echo "PACKAGE_MANAGER=$PM" >> "$GITHUB_OUTPUT"
4246
if [ "$PM" == "pnpm" ]; then
43-
echo "CACHE=pnpm" >> "$GITHUB_OUTPUT"
47+
echo "CACHE_MANAGER_VALUE=pnpm" >> "$GITHUB_OUTPUT"
4448
fi
4549
4650
- if: steps.packageManager.outputs.PACKAGE_MANAGER == 'pnpm'
@@ -52,4 +56,4 @@ runs:
5256
with:
5357
node-version-file: ${{ inputs.node-version-file-path }}
5458
node-version: ${{ inputs.node-version }}
55-
cache: ${{ steps.packageManager.outputs.CACHE }}
59+
cache: ${{ inputs.disable-package-manager-cache != 'true' && steps.packageManager.outputs.CACHE_MANAGER_VALUE || '' }}

0 commit comments

Comments
 (0)