@@ -17,18 +17,6 @@ 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- cache-node-modules :
21- default : false
22- type : boolean
23- description : |
24- Whether to cache the node_modules directory, this is helpful when postinstalls are performed
25- and modify the resulting node_modules directory. Defaults to False.
26-
27- node-module-directories :
28- default : ./node_modules
29- description : |
30- Space delimited list of node_modules directories to cache. Defaults to `./node_modules`
31-
3220runs :
3321 using : composite
3422 steps :
@@ -46,23 +34,22 @@ runs:
4634 persist-credentials : false
4735 ref : ${{ inputs.ref }}
4836
49- - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
50- with :
51- node-version-file : ${{ inputs.node-version-file-path }}
52- node-version : ${{ inputs.node-version }}
53-
5437 - id : packageManager
5538 shell : bash
5639 run : |
57- echo "PACKAGE_MANAGER=$(cat package.json | jq ".packageManager" | sed -E 's/"(npm|pnpm|yarn)@.*/\1/g')" > "$GITHUB_OUTPUT"
40+ PM=$(jq -r '.packageManager | match("^(npm|pnpm|yarn)@").captures[0].string' package.json || echo "")
41+ echo "PACKAGE_MANAGER=$PM" >> "$GITHUB_OUTPUT"
42+ if [ "$PM" == "pnpm" ]; then
43+ echo "CACHE=pnpm" >> "$GITHUB_OUTPUT"
44+ fi
5845
5946 - if : steps.packageManager.outputs.PACKAGE_MANAGER == 'pnpm'
6047 uses : pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
48+ with :
49+ run_install : false
6150
62-
63- # TODO(josephperrott): Determine if its safe to use this caching step.
64- # - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
65- # if: ${{ inputs.cache-node-modules == 'true' }}
66- # with:
67- # path: ${{ inputs.node-module-directories }}
68- # key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }}
51+ - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
52+ with :
53+ node-version-file : ${{ inputs.node-version-file-path }}
54+ node-version : ${{ inputs.node-version }}
55+ cache : ${{ steps.packageManager.outputs.CACHE }}
0 commit comments