Enhance caching in setup-node with automatic package manager detection (#1348)

* setup node in local

* Enhance caching in setup-node with package manager filed detection

* updated with array

* update the field
This commit is contained in:
priya-kinthali
2025-08-26 08:10:12 +05:30
committed by GitHub
parent 5e2628c959
commit d7a11313b5
7 changed files with 167 additions and 4 deletions

View File

@@ -243,3 +243,28 @@ jobs:
cache-dependency-path: |
sub2/*.lock
sub3/*.lock
node-npm-package-manager-cache:
name: Test enabling cache if package manager field is present (Node ${{ matrix.node-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- name: Create package.json with packageManager field
run: |
echo '{ "name": "test-project", "version": "1.0.0", "packageManager": "npm@8.0.0" }' > package.json
- name: Clean global cache
run: npm cache clean --force
- name: Setup Node with caching enabled
uses: ./
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Verify node and npm
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
shell: bash