You've already forked setup-dotnet
mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-09-01 02:14:14 +07:00
Fallback logic
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user