follow proxy settings (#105)

This commit is contained in:
eric sciple 2020-01-27 10:37:12 -05:00 committed by GitHub
parent 9a99bb3e35
commit d123f10543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
568 changed files with 15975 additions and 93743 deletions

View file

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