diff --git a/README.md b/README.md index eb3d071..c624808 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Internally the action uses node's semver package to resolve version ranges. Its #### WARNING: Version ranges are experimental and potentially unstable -For now, the action fetches the list of available Julia releases from the GitHub API. During testing it has happened that the host the action runner was on was hit by rate limiting. Once it's available we will use a list of versions provided on julialang.org. +For now, the action fetches the list of available Julia releases from the GitHub API. During testing it has happened that the host the action runner was on was hit by rate limiting. If this happens, the action falls back to a hardcoded list of releases. Once available we will use a list of versions provided on julialang.org. ### Matrix Testing diff --git a/lib/installer.js b/lib/installer.js index 6c7caec..a86be68 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -25,6 +25,8 @@ const semver = __importStar(require("semver")); // Store information about the environment const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS) core.debug(`platform: ${osPlat}`); +// This is temporary until we have a better way of fetching releases than GitHub's API +const fallbackVersions = ['v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0', 'v0.7.0', 'v1.0.0-rc1', 'v0.7.0-rc3', 'v0.7.0-rc2', 'v0.7.0-rc1', 'v0.7.0-beta2', 'v0.6.4', 'v0.7.0-beta', 'v0.7.0-alpha', 'v0.6.3', 'v0.6.2', 'v0.6.1', 'v0.6.0', 'v0.6.0-rc3', 'v0.6.0-rc2', 'v0.5.2', 'v0.6.0-rc1', 'v0.6.0-pre.beta', 'v0.5.1', 'v0.6.0-pre.alpha', 'v0.5.0', 'v0.4.7', 'v0.5.0-rc4', 'v0.5.0-rc3', 'v0.5.0-rc2', 'v0.5.0-rc1', 'v0.5.0-rc0', 'v0.4.6', 'v0.4.5', 'v0.4.4', 'v0.4.3', 'v0.4.2', 'v0.4.1', 'v0.3.12', 'v0.4.0', 'v0.4.0-rc4', 'v0.4.0-rc3', 'v0.4.0-rc2', 'v0.4.0-rc1', 'v0.3.11', 'v0.3.10', 'v0.3.9', 'v0.3.8', 'v0.3.7', 'v0.3.6', 'v0.3.5', 'v0.3.4', 'v0.3.3', 'v0.3.2', 'v0.3.1', 'v0.3.0', 'v0.3.0-rc4', 'v0.3.0-rc3', 'v0.3.0-rc2', 'v0.3.0-rc1', 'v0.2.0-rc1', 'v0.2.0-rc3', 'v0.2.0-rc4', 'v0.2.0', 'v0.2.0-rc2']; function getJuliaReleases() { return __awaiter(this, void 0, void 0, function* () { // Wrap everything in a Promise so that it can be called with await. @@ -45,6 +47,13 @@ function getJuliaReleases() { }); res.on('end', () => { core.debug(data); + if (res.statusCode != 200) { + // This is temporary until we have a better way of fetching releases than GitHub's API + console.log(`GitHub API request failed with status code ${res.statusCode}`); + console.log('Check the debug logs for more information'); + console.log('Falling back to hardcoded versions'); + resolve(fallbackVersions); + } resolve(JSON.parse(data).map((r) => r.tag_name)); }); }).on('error', err => { diff --git a/src/installer.ts b/src/installer.ts index 427f021..219bb38 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -12,6 +12,9 @@ import * as semver from 'semver' const osPlat = os.platform() // possible values: win32 (Windows), linux (Linux), darwin (macOS) core.debug(`platform: ${osPlat}`) +// This is temporary until we have a better way of fetching releases than GitHub's API +const fallbackVersions = ['v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0', 'v0.7.0', 'v1.0.0-rc1', 'v0.7.0-rc3', 'v0.7.0-rc2', 'v0.7.0-rc1', 'v0.7.0-beta2', 'v0.6.4', 'v0.7.0-beta', 'v0.7.0-alpha', 'v0.6.3', 'v0.6.2', 'v0.6.1', 'v0.6.0', 'v0.6.0-rc3', 'v0.6.0-rc2', 'v0.5.2', 'v0.6.0-rc1', 'v0.6.0-pre.beta', 'v0.5.1', 'v0.6.0-pre.alpha', 'v0.5.0', 'v0.4.7', 'v0.5.0-rc4', 'v0.5.0-rc3', 'v0.5.0-rc2', 'v0.5.0-rc1', 'v0.5.0-rc0', 'v0.4.6', 'v0.4.5', 'v0.4.4', 'v0.4.3', 'v0.4.2', 'v0.4.1', 'v0.3.12', 'v0.4.0', 'v0.4.0-rc4', 'v0.4.0-rc3', 'v0.4.0-rc2', 'v0.4.0-rc1', 'v0.3.11', 'v0.3.10', 'v0.3.9', 'v0.3.8', 'v0.3.7', 'v0.3.6', 'v0.3.5', 'v0.3.4', 'v0.3.3', 'v0.3.2', 'v0.3.1', 'v0.3.0', 'v0.3.0-rc4', 'v0.3.0-rc3', 'v0.3.0-rc2', 'v0.3.0-rc1', 'v0.2.0-rc1', 'v0.2.0-rc3', 'v0.2.0-rc4', 'v0.2.0', 'v0.2.0-rc2'] + export async function getJuliaReleases(): Promise { // Wrap everything in a Promise so that it can be called with await. return new Promise((resolve, reject) => { @@ -34,6 +37,16 @@ export async function getJuliaReleases(): Promise { res.on('end', () => { core.debug(data) + + if (res.statusCode != 200) { + // This is temporary until we have a better way of fetching releases than GitHub's API + console.log(`GitHub API request failed with status code ${res.statusCode}`) + console.log('Check the debug logs for more information') + console.log('Falling back to hardcoded versions') + + resolve(fallbackVersions) + } + resolve(JSON.parse(data).map((r) => r.tag_name as string)) }) }).on('error', err => {