mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 12:54:45 +00:00
Update tool-cache for download retries (#120)
This commit is contained in:
parent
ada4b782b3
commit
83c9f7a7df
8 changed files with 266 additions and 177 deletions
|
@ -1,5 +1,3 @@
|
|||
// Load tempDirectory before it gets wiped by tool-cache
|
||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
||||
import * as assert from 'assert';
|
||||
import * as core from '@actions/core';
|
||||
import * as hc from '@actions/http-client';
|
||||
|
@ -12,21 +10,6 @@ import * as semver from 'semver';
|
|||
let osPlat: string = os.platform();
|
||||
let osArch: string = translateArchToDistUrl(os.arch());
|
||||
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (process.platform === 'win32') {
|
||||
// On windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
} else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
} else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
|
||||
//
|
||||
// Node versions interface
|
||||
// see https://nodejs.org/dist/index.json
|
||||
|
@ -206,9 +189,11 @@ async function acquireNodeFromFallbackLocation(
|
|||
version: string
|
||||
): Promise<string> {
|
||||
// Create temporary folder to download in to
|
||||
let tempDownloadFolder: string =
|
||||
const tempDownloadFolder: string =
|
||||
'temp_' + Math.floor(Math.random() * 2000000000);
|
||||
let tempDir: string = path.join(tempDirectory, tempDownloadFolder);
|
||||
const tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
assert.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
|
||||
const tempDir: string = path.join(tempDirectory, tempDownloadFolder);
|
||||
await io.mkdirP(tempDir);
|
||||
let exeUrl: string;
|
||||
let libUrl: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue