Skip to content

Commit

Permalink
Make sure also prereleases are retrieved
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Dec 20, 2024
1 parent c45aaa8 commit e293b64
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Src/GBX.NET.Tool.CLI/ToolUpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ToolUpdateChecker(Task<HttpResponseMessage> updateInfoResponseTask)
return null;
}

var responseTask = client.GetAsync($"https://api.github.com/repos/{githubRepo}/releases/latest", cancellationToken);
var responseTask = client.GetAsync($"https://api.github.com/repos/{githubRepo}/releases", cancellationToken);
return new ToolUpdateChecker(responseTask);
}

Expand Down Expand Up @@ -49,13 +49,17 @@ public async Task CompareVersionAsync(CancellationToken cancellationToken)

try
{
var updateInfo = await updateInfoResponse.Content.ReadFromJsonAsync(GitHubJsonContext.Default.UpdateInfo, cancellationToken);

if (updateInfo is not null)
await foreach (var updateInfo in updateInfoResponse.Content.ReadFromJsonAsAsyncEnumerable(GitHubJsonContext.Default.UpdateInfo, cancellationToken))
{
AnsiConsole.MarkupLine($"[yellow]Latest version available:[/] [green]{updateInfo.TagName?.TrimStart('v')}[/]");
AnsiConsole.MarkupLine($"[yellow]Release notes:[/] [green]{updateInfo.HtmlUrl}[/]");
if (updateInfo is not null)
{
AnsiConsole.MarkupLine($"[yellow]Latest version available:[/] [green]{updateInfo.TagName?.TrimStart('v')}[/]");
AnsiConsole.MarkupLine($"[yellow]Release notes:[/] [green]{updateInfo.HtmlUrl}[/]");
}

break;
}

}
catch (Exception ex)
{
Expand Down

0 comments on commit e293b64

Please sign in to comment.