mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-06-07 20:51:11 +00:00
Expand node version file support to include lts based codenames
This commit is contained in:
parent
c3812bd36a
commit
a0d376d3fa
7 changed files with 311 additions and 43 deletions
21
src/node-version.ts
Normal file
21
src/node-version.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import * as hc from '@actions/http-client';
|
||||
|
||||
//
|
||||
// Node versions interface
|
||||
// see https://nodejs.org/dist/index.json
|
||||
//
|
||||
export interface INodeVersion {
|
||||
version: string;
|
||||
files: string[];
|
||||
lts: boolean | string;
|
||||
}
|
||||
|
||||
export async function getVersionsFromDist(): Promise<INodeVersion[]> {
|
||||
let dataUrl = 'https://nodejs.org/dist/index.json';
|
||||
let httpClient = new hc.HttpClient('setup-node', [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
let response = await httpClient.getJson<INodeVersion[]>(dataUrl);
|
||||
return response.result || [];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue