mirror of
https://github.com/actions/setup-node.git
synced 2025-06-30 22:53:50 +00:00
.
This commit is contained in:
parent
beb1329f9f
commit
2b95e76931
7736 changed files with 1874747 additions and 51184 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,11 @@ 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