mirror of
https://github.com/actions/setup-node.git
synced 2026-06-14 14:13:52 +08:00
Compare commits
3 Commits
v6.0.0
...
b4b5a20206
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4b5a20206 | ||
|
|
dda4788290 | ||
|
|
b858c04541 |
@@ -162,7 +162,14 @@ describe('setup-node', () => {
|
||||
'mocktoken'
|
||||
);
|
||||
expect(versions).toBeDefined();
|
||||
const match = await tc.findFromManifest(versionSpec, true, versions);
|
||||
const match = await tc.findFromManifest(
|
||||
versionSpec,
|
||||
true,
|
||||
versions,
|
||||
// `archFilter` parameter of `findFromManifest` function has a default value of `os.arch()`.
|
||||
// However, default parameters cannot be replaced by `spyOn` function of Jest.
|
||||
osm.arch()
|
||||
);
|
||||
expect(match).toBeDefined();
|
||||
expect(match?.version).toBe(expectedVersion);
|
||||
expect((match as any).lts).toBe(expectedLts);
|
||||
|
||||
@@ -300,6 +300,35 @@ steps:
|
||||
- run: npm test
|
||||
```
|
||||
|
||||
**Restore-Only Cache**
|
||||
|
||||
```yaml
|
||||
## In some workflows, you may want to restore a cache without saving it. This can help reduce cache writes and storage usage in workflows that only need to read from cache
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
# Restore Node.js modules cache (restore-only)
|
||||
- name: Restore Node modules cache
|
||||
uses: actions/cache@v4
|
||||
id: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
# Setup Node.js
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
# Install dependencies
|
||||
- run: npm install
|
||||
```
|
||||
|
||||
> For more details related to cache scenarios, please refer [Node – npm](https://github.com/actions/cache/blob/main/examples.md#node---npm).
|
||||
|
||||
## Multiple Operating Systems and Architectures
|
||||
|
||||
```yaml
|
||||
|
||||
Reference in New Issue
Block a user