mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-01-18 14:21:44 +07:00
Fallback logic
This commit is contained in:
parent
0126ca49f0
commit
2984211dcd
9
dist/setup/index.js
vendored
9
dist/setup/index.js
vendored
@ -71264,7 +71264,13 @@ class DotnetVersionResolver {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
const response = yield httpClient.getJson(DotnetVersionResolver.DotNetCoreIndexUrl);
|
||||
let response;
|
||||
try {
|
||||
response = yield httpClient.getJson(DotnetVersionResolver.DotNetCoreIndexUrl);
|
||||
}
|
||||
catch (error) {
|
||||
response = yield httpClient.getJson(DotnetVersionResolver.DotnetCoreIndexFallbackUrl);
|
||||
}
|
||||
const result = response.result || {};
|
||||
const releasesInfo = result['releases-index'];
|
||||
const releaseInfo = releasesInfo.find(info => {
|
||||
@ -71280,6 +71286,7 @@ class DotnetVersionResolver {
|
||||
}
|
||||
exports.DotnetVersionResolver = DotnetVersionResolver;
|
||||
DotnetVersionResolver.DotNetCoreIndexUrl = 'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
|
||||
DotnetVersionResolver.DotnetCoreIndexFallbackUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json';
|
||||
class DotnetCoreInstaller {
|
||||
constructor(version, quality) {
|
||||
this.version = version;
|
||||
|
@ -101,9 +101,18 @@ export class DotnetVersionResolver {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
const response = await httpClient.getJson<any>(
|
||||
DotnetVersionResolver.DotNetCoreIndexUrl
|
||||
);
|
||||
|
||||
let response;
|
||||
try {
|
||||
response = await httpClient.getJson<any>(
|
||||
DotnetVersionResolver.DotNetCoreIndexUrl
|
||||
);
|
||||
} catch (error) {
|
||||
response = await httpClient.getJson<any>(
|
||||
DotnetVersionResolver.DotnetCoreIndexFallbackUrl
|
||||
);
|
||||
}
|
||||
|
||||
const result = response.result || {};
|
||||
const releasesInfo: any[] = result['releases-index'];
|
||||
|
||||
@ -123,6 +132,10 @@ export class DotnetVersionResolver {
|
||||
|
||||
static DotNetCoreIndexUrl =
|
||||
'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
|
||||
|
||||
static DotnetCoreIndexFallbackUrl =
|
||||
'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json';
|
||||
|
||||
}
|
||||
|
||||
export class DotnetCoreInstaller {
|
||||
|
Loading…
Reference in New Issue
Block a user