mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 12:54:45 +00:00
follow proxy settings (#105)
This commit is contained in:
parent
9a99bb3e35
commit
d123f10543
568 changed files with 15975 additions and 93743 deletions
|
@ -1,9 +1,10 @@
|
|||
// 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';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as restm from 'typed-rest-client/RestClient';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
|
@ -100,9 +101,17 @@ async function queryLatestMatch(versionSpec: string): Promise<string> {
|
|||
|
||||
let versions: string[] = [];
|
||||
let dataUrl = 'https://nodejs.org/dist/index.json';
|
||||
let rest: restm.RestClient = new restm.RestClient('setup-node');
|
||||
let nodeVersions: INodeVersion[] =
|
||||
(await rest.get<INodeVersion[]>(dataUrl)).result || [];
|
||||
let httpClient = new hc.HttpClient('setup-node', [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
let response = await httpClient.get(dataUrl);
|
||||
assert.ok(
|
||||
response.message.statusCode === 200,
|
||||
`Unexpected HTTP status code '${response.message.statusCode}'`
|
||||
);
|
||||
let body = await response.readBody();
|
||||
let nodeVersions = JSON.parse(body) as INodeVersion[];
|
||||
nodeVersions.forEach((nodeVersion: INodeVersion) => {
|
||||
// ensure this version supports your os and platform
|
||||
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue