Replace uuid with crypto.randomUUID()

This commit is contained in:
Kamat, Trivikram 2025-09-23 17:56:00 -07:00
parent 89d709d423
commit a1962a642f
3 changed files with 3 additions and 19 deletions

16
package-lock.json generated
View File

@ -17,8 +17,7 @@
"@actions/http-client": "^2.2.1", "@actions/http-client": "^2.2.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.2", "@actions/tool-cache": "^2.0.2",
"semver": "^7.6.3", "semver": "^7.6.3"
"uuid": "^11.1.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
@ -5683,19 +5682,6 @@
"punycode": "^2.1.0" "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": { "node_modules/v8-to-istanbul": {
"version": "9.1.3", "version": "9.1.3",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz", "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/http-client": "^2.2.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.2", "@actions/tool-cache": "^2.0.2",
"semver": "^7.6.3", "semver": "^7.6.3"
"uuid": "^11.1.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@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 tc from '@actions/tool-cache';
import * as hc from '@actions/http-client'; import * as hc from '@actions/http-client';
import * as core from '@actions/core'; import * as core from '@actions/core';
@ -185,7 +184,7 @@ export default abstract class BaseDistribution {
const osArch: string = this.translateArchToDistUrl(arch); const osArch: string = this.translateArchToDistUrl(arch);
// Create temporary folder to download to // Create temporary folder to download to
const tempDownloadFolder = `temp_${uuidv4()}`; const tempDownloadFolder = `temp_${crypto.randomUUID()}`;
const tempDirectory = process.env['RUNNER_TEMP'] || ''; const tempDirectory = process.env['RUNNER_TEMP'] || '';
assert.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined'); assert.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
const tempDir: string = path.join(tempDirectory, tempDownloadFolder); const tempDir: string = path.join(tempDirectory, tempDownloadFolder);