Skip to content

Commit e24a0bf

Browse files
committed
feat(github-actions): install pnpm in actions environment when pnpm is set at the package manager
Based on the package manager value of the root package.json file, conditionally install pnpm
1 parent 4fae4f3 commit e24a0bf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ runs:
5151
node-version-file: ${{ inputs.node-version-file-path }}
5252
node-version: ${{ inputs.node-version }}
5353

54+
- id: packageManager
55+
shell: bash
56+
run: |
57+
echo "PACKAGE_MANAGER=$(cat package.json | jq ".packageManager" | sed -E 's/"(npm|pnpm|yarn).*$/\1/g')" > "$GITHUB_OUTPUT"
58+
59+
- if: steps.packageManager.outputs.PACKAGE_MANAGER == 'pnpm'
60+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
61+
5462
# TODO(josephperrott): Determine if its safe to use this caching step.
5563
# - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
5664
# if: ${{ inputs.cache-node-modules == 'true' }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"default": "./*"
1616
}
1717
},
18-
"packageManager": "[email protected].0",
18+
"packageManager": "[email protected].0",
1919
"dependencies": {
2020
"@angular/benchpress": "0.3.0",
2121
"@angular/build": "20.0.0-next.0",

0 commit comments

Comments
 (0)