4
0
Fork 0
mirror of https://github.com/actions/setup-node.git synced 2025-11-07 04:56:55 +00:00

Compare commits

...

5 commits

Author SHA1 Message Date
Trivikram Kamat
2b8a28d01e
Merge 7944727638 into dda4788290 2025-10-22 00:36:09 -03:00
aparnajyothi-y
dda4788290
Add example for restore-only cache in documentation (#1419)
* Update versions.yml

* Update versions.yml

* doc update

* update

* update

* doc update
2025-10-21 14:44:57 -05:00
Kamat, Trivikram
7944727638 chore: update files in dist 2025-10-08 08:48:30 -07:00
Kamat, Trivikram
ee2d14815c chore: license cache 2025-10-08 08:37:37 -07:00
Kamat, Trivikram
34c363a48a Replace uuid with crypto.randomUUID() 2025-10-08 08:29:38 -07:00
7 changed files with 1632 additions and 2257 deletions

View file

@ -1,20 +0,0 @@
---
name: uuid
version: 11.1.0
type: npm
summary: RFC9562 UUIDs
homepage:
license: mit
licenses:
- sources: LICENSE.md
text: |
The MIT License (MIT)
Copyright (c) 2010-2020 Robert Kieffer and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View file

@ -3,7 +3,7 @@ name: uuid
version: 8.3.2
type: npm
summary: RFC4122 (v1, v4, and v5) UUIDs
homepage: https://github.com/uuidjs/uuid#readme
homepage:
license: mit
licenses:
- sources: LICENSE.md

3816
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -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

16
package-lock.json generated
View file

@ -17,8 +17,7 @@
"@actions/http-client": "^2.2.1",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.2",
"semver": "^7.6.3",
"uuid": "^11.1.0"
"semver": "^7.6.3"
},
"devDependencies": {
"@types/jest": "^29.5.14",
@ -5683,19 +5682,6 @@
"punycode": "^2.1.0"
}
},
"node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/v8-to-istanbul": {
"version": "9.1.3",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz",

View file

@ -36,8 +36,7 @@
"@actions/http-client": "^2.2.1",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.2",
"semver": "^7.6.3",
"uuid": "^11.1.0"
"semver": "^7.6.3"
},
"devDependencies": {
"@types/jest": "^29.5.14",

View file

@ -1,4 +1,3 @@
import {v4 as uuidv4} from 'uuid';
import * as tc from '@actions/tool-cache';
import * as hc from '@actions/http-client';
import * as core from '@actions/core';
@ -185,7 +184,7 @@ export default abstract class BaseDistribution {
const osArch: string = this.translateArchToDistUrl(arch);
// Create temporary folder to download to
const tempDownloadFolder = `temp_${uuidv4()}`;
const tempDownloadFolder = `temp_${crypto.randomUUID()}`;
const tempDirectory = process.env['RUNNER_TEMP'] || '';
assert.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
const tempDir: string = path.join(tempDirectory, tempDownloadFolder);