diff --git a/Clients/CirrusCiClient/CirrusCiClient.csproj b/Clients/CirrusCiClient/CirrusCiClient.csproj
index d0da0f46..0400f055 100644
--- a/Clients/CirrusCiClient/CirrusCiClient.csproj
+++ b/Clients/CirrusCiClient/CirrusCiClient.csproj
@@ -9,9 +9,9 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/Clients/CompatApiClient/CompatApiClient.csproj b/Clients/CompatApiClient/CompatApiClient.csproj
index 6ac63cc0..0cf1438f 100644
--- a/Clients/CompatApiClient/CompatApiClient.csproj
+++ b/Clients/CompatApiClient/CompatApiClient.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/Clients/GithubClient/GithubClient.csproj b/Clients/GithubClient/GithubClient.csproj
index bbe16a6f..ec7f84d7 100644
--- a/Clients/GithubClient/GithubClient.csproj
+++ b/Clients/GithubClient/GithubClient.csproj
@@ -5,7 +5,7 @@
enable
-
+
diff --git a/Clients/IrdLibraryClient/IrdLibraryClient.csproj b/Clients/IrdLibraryClient/IrdLibraryClient.csproj
index 0a96ee16..7e8d5333 100644
--- a/Clients/IrdLibraryClient/IrdLibraryClient.csproj
+++ b/Clients/IrdLibraryClient/IrdLibraryClient.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/Clients/PsnClient/PsnClient.csproj b/Clients/PsnClient/PsnClient.csproj
index ac3b279d..a73aac9d 100644
--- a/Clients/PsnClient/PsnClient.csproj
+++ b/Clients/PsnClient/PsnClient.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/CompatBot/Commands/Pr.cs b/CompatBot/Commands/Pr.cs
index e9d33c36..420024b2 100644
--- a/CompatBot/Commands/Pr.cs
+++ b/CompatBot/Commands/Pr.cs
@@ -2,9 +2,6 @@
using CompatBot.Database.Providers;
using CompatBot.Utils.Extensions;
using CompatBot.Utils.ResultFormatters;
-using Microsoft.TeamFoundation.Build.WebApi;
-using Octokit;
-using BuildStatus = Microsoft.TeamFoundation.Build.WebApi.BuildStatus;
namespace CompatBot.Commands;
@@ -13,7 +10,6 @@ namespace CompatBot.Commands;
internal sealed class Pr
{
private static readonly GithubClient.Client GithubClient = new(Config.GithubToken);
- private static readonly CompatApiClient.Client CompatApiClient = new();
[Command("search")]
[Description("Search for open pull requests")]
@@ -71,7 +67,7 @@ internal sealed class Pr
if (openPrList is [{}item])
{
- var msg = await GetPrBuildMessageAsync(ctx.Client, item.Number).ConfigureAwait(false);
+ var msg = await PrUpdateInfoFormatter.GetPrBuildMessageAsync(ctx.Client, item.Number).ConfigureAwait(false);
await ctx.RespondAsync(new DiscordInteractionResponseBuilder(msg).AsEphemeral(ephemeral)).ConfigureAwait(false);
return;
}
@@ -93,7 +89,7 @@ internal sealed class Pr
{
var ephemeral = !ctx.Channel.IsSpamChannel() && !ModProvider.IsMod(ctx.User.Id);
await ctx.DeferResponseAsync(ephemeral).ConfigureAwait(false);
- var response = await GetPrBuildMessageAsync(ctx.Client, pr).ConfigureAwait(false);
+ var response = await PrUpdateInfoFormatter.GetPrBuildMessageAsync(ctx.Client, pr).ConfigureAwait(false);
await ctx.RespondAsync(new DiscordInteractionResponseBuilder(response).AsEphemeral(ephemeral)).ConfigureAwait(false);
}
@@ -103,7 +99,7 @@ internal sealed class Pr
{
var ephemeral = !ctx.Channel.IsSpamChannel() && !ModProvider.IsMod(ctx.User.Id);
await ctx.DeferResponseAsync(ephemeral).ConfigureAwait(false);
- var msg = await GetPrBuildMessageAsync(ctx.Client, pr, true).ConfigureAwait(false);
+ var msg = await PrUpdateInfoFormatter.GetPrBuildMessageAsync(ctx.Client, pr, true).ConfigureAwait(false);
await ctx.RespondAsync(new DiscordInteractionResponseBuilder(msg).AsEphemeral(ephemeral)).ConfigureAwait(false);
}
@@ -125,209 +121,6 @@ internal sealed class Pr
}
#endif
- private static async ValueTask GetPrBuildMessageAsync(DiscordClient client, int pr, bool linkOld = false)
- {
- var prInfo = await GithubClient.GetPrInfoAsync(pr, Config.Cts.Token).ConfigureAwait(false);
- var result = new DiscordMessageBuilder();
- if (prInfo is null or {Number: 0})
- return result.WithContent($"{Config.Reactions.Failure} {prInfo?.Title ?? "PR not found"}");
-
- var (state, _) = prInfo.GetState();
- var embed = prInfo.AsEmbed();
- if (state is "Open" or "Closed")
- {
- var windowsDownloadHeader = "Windows x64 PR Build";
- var linuxDownloadHeader = "Linux x64 PR Build";
- var macDownloadHeader = "Mac Intel PR Build";
- var windowsArmDownloadHeader = "Windows ARM64 PR Build";
- var linuxArmDownloadHeader = "Linux ARM64 PR Build";
- var macArmDownloadHeader = "Mac Apple Silicon PR Build";
- string? windowsDownloadText = null;
- string? linuxDownloadText = null;
- string? macDownloadText = null;
- string? windowsArmDownloadText = null;
- string? linuxArmDownloadText = null;
- string? macArmDownloadText = null;
- string? buildTime = null;
-
- if (prInfo is {Head.Sha: {Length: >0} commit})
- try
- {
- windowsDownloadText = "⏳ Pending…";
- linuxDownloadText = "⏳ Pending…";
- macDownloadText = "⏳ Pending…";
- windowsArmDownloadText = "⏳ Pending…";
- linuxArmDownloadText = "⏳ Pending…";
- macArmDownloadText = "⏳ Pending…";
- var ghBuild = await GithubClient.GetPrBuildInfoAsync(commit, prInfo.MergedAt?.DateTime, pr, Config.Cts.Token).ConfigureAwait(false);
- if (ghBuild is null)
- {
- if (state is "Open")
- {
- embed.WithFooter($"Opened on {prInfo.CreatedAt:u} ({(DateTime.UtcNow - prInfo.CreatedAt).AsTimeDeltaDescription()} ago)");
- }
- windowsDownloadText = null;
- linuxDownloadText = null;
- macDownloadText = null;
- windowsArmDownloadText = null;
- linuxArmDownloadText = null;
- macArmDownloadText = null;
- }
- if (ghBuild is not null)
- {
- var shouldHaveArtifacts = false;
- if (ghBuild is
- {
- Status: WorkflowRunStatus.Completed,
- Result: WorkflowRunConclusion.Success
- })
- {
- buildTime = $"Built on {ghBuild.FinishTime:u} ({(DateTime.UtcNow - ghBuild.FinishTime).AsTimeDeltaDescription()} ago)";
- shouldHaveArtifacts = true;
- }
-
- // Check for subtask errors (win/lin/mac)
- if (ghBuild is { Result: WorkflowRunConclusion.Failure or WorkflowRunConclusion.Cancelled or WorkflowRunConclusion.TimedOut })
- {
- windowsDownloadText = $"❌ {ghBuild.Result}";
- linuxDownloadText = $"❌ {ghBuild.Result}";
- windowsArmDownloadText = $"❌ {ghBuild.Result}";
- linuxArmDownloadText = $"❌ {ghBuild.Result}";
- }
-
- // Check estimated time for pending builds
- if (ghBuild is { Status: WorkflowRunStatus.Waiting or WorkflowRunStatus.Pending or WorkflowRunStatus.InProgress })
- {
- var estimatedCompletionTime = ghBuild.StartTime + (await GithubClient.GetPipelineDurationAsync(Config.Cts.Token).ConfigureAwait(false)).Mean;
- var estimatedTime = TimeSpan.FromMinutes(1);
- if (estimatedCompletionTime > DateTime.UtcNow)
- estimatedTime = estimatedCompletionTime - DateTime.UtcNow;
- windowsDownloadText = $"⏳ Pending in {estimatedTime.AsTimeDeltaDescription()}…";
- linuxDownloadText = windowsDownloadText;
- //macDownloadText = windowsDownloadText;
- windowsArmDownloadText = windowsDownloadText;
- linuxArmDownloadText = windowsDownloadText;
- //macArmDownloadText = windowsDownloadText;
- }
-
- // windows build
- var name = ghBuild.WindowsFilename ?? "Windows PR Build";
- name = name.Replace("rpcs3-", "").Replace("_win64", "").Replace("_msvc", "");
- if (ghBuild.WindowsBuildDownloadLink is {Length: >0})
- windowsDownloadText = $"[⏬ {name}]({ghBuild.WindowsBuildDownloadLink})";
- else if (shouldHaveArtifacts)
- {
- if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
- windowsDownloadText = "No longer available";
- }
-
- // windows arm build
- name = ghBuild.WindowsArmFilename ?? "Windows ARM64 PR Build";
- name = name.Replace("rpcs3-", "").Replace("_aarch64", "").Replace("_clang", "");
- if (ghBuild.WindowsArmBuildDownloadLink is {Length: >0})
- windowsArmDownloadText = $"[⏬ {name}]({ghBuild.WindowsArmBuildDownloadLink})";
- else if (shouldHaveArtifacts)
- {
- if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
- windowsArmDownloadText = "No longer available";
- }
-
- // linux build
- name = ghBuild.LinuxFilename ?? "Linux PR Build";
- name = name.Replace("rpcs3-", "").Replace("_linux64", "");
- if (ghBuild.LinuxBuildDownloadLink is {Length: >0})
- linuxDownloadText = $"[⏬ {name}]({ghBuild.LinuxBuildDownloadLink})";
- else if (shouldHaveArtifacts)
- {
- if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
- linuxDownloadText = "No longer available";
- }
-
- // linux arm build
- name = ghBuild.LinuxArmFilename ?? "Linux ARM64 PR Build";
- name = name.Replace("rpcs3-", "").Replace("_linux_aarch64", "");
- if (ghBuild.LinuxArmBuildDownloadLink is {Length: >0})
- linuxArmDownloadText = $"[⏬ {name}]({ghBuild.LinuxArmBuildDownloadLink})";
- else if (shouldHaveArtifacts)
- {
- if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
- linuxArmDownloadText = "No longer available";
- }
-
- // mac build
- name = ghBuild.MacFilename ?? "Mac PR Build";
- name = name.Replace("rpcs3-", "").Replace("_macos", "");
- if (ghBuild.MacBuildDownloadLink is {Length: >0})
- macDownloadText = $"[⏬ {name}]({ghBuild.MacBuildDownloadLink})";
- else if (shouldHaveArtifacts)
- {
- if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
- macDownloadText = "No longer available";
- }
-
- // mac arm build
- name = ghBuild.MacArmFilename ?? "Mac Apple Silicon PR Build";
- name = name.Replace("rpcs3-", "").Replace("_macos", "").Replace("_arm64", "");
- if (ghBuild.MacArmBuildDownloadLink is {Length: >0})
- macArmDownloadText = $"[⏬ {name}]({ghBuild.MacArmBuildDownloadLink})";
- else if (shouldHaveArtifacts)
- {
- if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
- macArmDownloadText = "No longer available";
- }
- }
- }
- catch (Exception e)
- {
- Config.Log.Error(e, "Failed to get CI build info");
- windowsDownloadText = null; // probably due to expired access token
- linuxDownloadText = null;
- macDownloadText = null;
- windowsArmDownloadText = null;
- linuxArmDownloadText = null;
- macArmDownloadText = null;
- }
-
- if (!string.IsNullOrEmpty(windowsDownloadText))
- embed.AddField(windowsDownloadHeader, windowsDownloadText, true);
- if (!string.IsNullOrEmpty(linuxDownloadText))
- embed.AddField(linuxDownloadHeader, linuxDownloadText, true);
- if (!string.IsNullOrEmpty (macDownloadText))
- embed.AddField(macDownloadHeader, macDownloadText, true);
- if (!string.IsNullOrEmpty(windowsArmDownloadText))
- embed.AddField(windowsArmDownloadHeader, windowsArmDownloadText, true);
- if (!string.IsNullOrEmpty(linuxArmDownloadText))
- embed.AddField(linuxArmDownloadHeader, linuxArmDownloadText, true);
- if (!string.IsNullOrEmpty (macArmDownloadText))
- embed.AddField(macArmDownloadHeader, macArmDownloadText, true);
- if (!string.IsNullOrEmpty(buildTime))
- embed.WithFooter(buildTime);
- }
- else if (state is "Merged")
- {
- var mergeTime = prInfo.MergedAt.GetValueOrDefault();
- var now = DateTime.UtcNow;
- var updateInfo = await CompatApiClient.GetUpdateAsync(Config.Cts.Token, linkOld ? prInfo.MergeCommitSha : null).ConfigureAwait(false);
- if (updateInfo.LatestDatetime is DateTime masterBuildTime && masterBuildTime.Ticks >= mergeTime.Ticks)
- embed = await updateInfo.AsEmbedAsync(client, false, embed, prInfo, linkOld).ConfigureAwait(false);
- else
- {
- var waitTime = TimeSpan.FromMinutes(5);
- var avgBuildTime = (await GithubClient.GetPipelineDurationAsync(Config.Cts.Token).ConfigureAwait(false)).Mean;
- if (now < mergeTime + avgBuildTime)
- waitTime = mergeTime + avgBuildTime - now;
- embed.AddField(
- "Latest master build",
- $"""
- This pull request has been merged, and will be part of `master` very soon.
- Please check again in {waitTime.AsTimeDeltaDescription()}.
- """
- );
- }
- }
- return result.AddEmbed(embed);
- }
-
public static async ValueTask GetIssueLinkMessageAsync(DiscordClient client, int issue)
{
var issueInfo = await GithubClient.GetIssueInfoAsync(issue, Config.Cts.Token).ConfigureAwait(false);
@@ -335,7 +128,7 @@ internal sealed class Pr
return null;
if (issueInfo.PullRequest is not null)
- return await GetPrBuildMessageAsync(client, issue).ConfigureAwait(false);
+ return await PrUpdateInfoFormatter.GetPrBuildMessageAsync(client, issue).ConfigureAwait(false);
return new DiscordMessageBuilder().AddEmbed(issueInfo.AsEmbed());
}
diff --git a/CompatBot/CompatBot.csproj b/CompatBot/CompatBot.csproj
index 0a60ba7e..b30d94a2 100644
--- a/CompatBot/CompatBot.csproj
+++ b/CompatBot/CompatBot.csproj
@@ -54,15 +54,15 @@
-
-
+
+
all
runtime; build; native; analyzers; buildtransitive
-
-
-
-
+
+
+
+
diff --git a/CompatBot/Utils/ResultFormatters/PrUpdateInfoFormatter.cs b/CompatBot/Utils/ResultFormatters/PrUpdateInfoFormatter.cs
new file mode 100644
index 00000000..361535a4
--- /dev/null
+++ b/CompatBot/Utils/ResultFormatters/PrUpdateInfoFormatter.cs
@@ -0,0 +1,212 @@
+using Octokit;
+
+namespace CompatBot.Utils.ResultFormatters;
+
+internal class PrUpdateInfoFormatter
+{
+ private static readonly GithubClient.Client GithubClient = new(Config.GithubToken);
+ private static readonly CompatApiClient.Client CompatApiClient = new();
+
+ public static async ValueTask GetPrBuildMessageAsync(DiscordClient client, int pr, bool linkOld = false)
+ {
+ var prInfo = await GithubClient.GetPrInfoAsync(pr, Config.Cts.Token).ConfigureAwait(false);
+ var result = new DiscordMessageBuilder();
+ if (prInfo is null or { Number: 0 })
+ return result.WithContent($"{Config.Reactions.Failure} {prInfo?.Title ?? "PR not found"}");
+
+ var (state, _) = prInfo.GetState();
+ var embed = prInfo.AsEmbed();
+ if (state is "Open" or "Closed")
+ {
+ var windowsDownloadHeader = "Windows x64 PR Build";
+ var linuxDownloadHeader = "Linux x64 PR Build";
+ var macDownloadHeader = "Mac Intel PR Build";
+ var windowsArmDownloadHeader = "Windows ARM64 PR Build";
+ var linuxArmDownloadHeader = "Linux ARM64 PR Build";
+ var macArmDownloadHeader = "Mac Apple Silicon PR Build";
+ string? windowsDownloadText = null;
+ string? linuxDownloadText = null;
+ string? macDownloadText = null;
+ string? windowsArmDownloadText = null;
+ string? linuxArmDownloadText = null;
+ string? macArmDownloadText = null;
+ string? buildTime = null;
+
+ if (prInfo is { Head.Sha: { Length: > 0 } commit })
+ try
+ {
+ windowsDownloadText = "⏳ Pending…";
+ linuxDownloadText = "⏳ Pending…";
+ macDownloadText = "⏳ Pending…";
+ windowsArmDownloadText = "⏳ Pending…";
+ linuxArmDownloadText = "⏳ Pending…";
+ macArmDownloadText = "⏳ Pending…";
+ var ghBuild = await GithubClient.GetPrBuildInfoAsync(commit, prInfo.MergedAt?.DateTime, pr, Config.Cts.Token).ConfigureAwait(false);
+ if (ghBuild is null)
+ {
+ if (state is "Open")
+ {
+ embed.WithFooter($"Opened on {prInfo.CreatedAt:u} ({(DateTime.UtcNow - prInfo.CreatedAt).AsTimeDeltaDescription()} ago)");
+ }
+ windowsDownloadText = null;
+ linuxDownloadText = null;
+ macDownloadText = null;
+ windowsArmDownloadText = null;
+ linuxArmDownloadText = null;
+ macArmDownloadText = null;
+ }
+ if (ghBuild is not null)
+ {
+ var shouldHaveArtifacts = false;
+ if (ghBuild is
+ {
+ Status: WorkflowRunStatus.Completed,
+ Result: WorkflowRunConclusion.Success
+ })
+ {
+ buildTime = $"Built on {ghBuild.FinishTime:u} ({(DateTime.UtcNow - ghBuild.FinishTime).AsTimeDeltaDescription()} ago)";
+ shouldHaveArtifacts = true;
+ }
+
+ // Check for subtask errors (win/lin/mac)
+ if (ghBuild is { Result: WorkflowRunConclusion.Failure or WorkflowRunConclusion.Cancelled or WorkflowRunConclusion.TimedOut })
+ {
+ windowsDownloadText = $"❌ {ghBuild.Result}";
+ linuxDownloadText = $"❌ {ghBuild.Result}";
+ windowsArmDownloadText = $"❌ {ghBuild.Result}";
+ linuxArmDownloadText = $"❌ {ghBuild.Result}";
+ }
+
+ // Check estimated time for pending builds
+ if (ghBuild is { Status: WorkflowRunStatus.Waiting or WorkflowRunStatus.Pending or WorkflowRunStatus.InProgress })
+ {
+ var estimatedCompletionTime = ghBuild.StartTime + (await GithubClient.GetPipelineDurationAsync(Config.Cts.Token).ConfigureAwait(false)).Mean;
+ var estimatedTime = TimeSpan.FromMinutes(1);
+ if (estimatedCompletionTime > DateTime.UtcNow)
+ estimatedTime = estimatedCompletionTime - DateTime.UtcNow;
+ windowsDownloadText = $"⏳ Pending in {estimatedTime.AsTimeDeltaDescription()}…";
+ linuxDownloadText = windowsDownloadText;
+ //macDownloadText = windowsDownloadText;
+ windowsArmDownloadText = windowsDownloadText;
+ linuxArmDownloadText = windowsDownloadText;
+ //macArmDownloadText = windowsDownloadText;
+ }
+
+ // windows build
+ var name = ghBuild.WindowsFilename ?? "Windows PR Build";
+ name = name.Replace("rpcs3-", "").Replace("_win64", "").Replace("_msvc", "");
+ if (ghBuild.WindowsBuildDownloadLink is { Length: > 0 })
+ windowsDownloadText = $"[⏬ {name}]({ghBuild.WindowsBuildDownloadLink})";
+ else if (shouldHaveArtifacts)
+ {
+ if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
+ windowsDownloadText = "No longer available";
+ }
+
+ // windows arm build
+ name = ghBuild.WindowsArmFilename ?? "Windows ARM64 PR Build";
+ name = name.Replace("rpcs3-", "").Replace("_win64", "").Replace("_aarch64", "").Replace("_clang", "");
+ if (ghBuild.WindowsArmBuildDownloadLink is { Length: > 0 })
+ windowsArmDownloadText = $"[⏬ {name}]({ghBuild.WindowsArmBuildDownloadLink})";
+ else if (shouldHaveArtifacts)
+ {
+ if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
+ windowsArmDownloadText = "No longer available";
+ }
+
+ // linux build
+ name = ghBuild.LinuxFilename ?? "Linux PR Build";
+ name = name.Replace("rpcs3-", "").Replace("_linux64", "");
+ if (ghBuild.LinuxBuildDownloadLink is { Length: > 0 })
+ linuxDownloadText = $"[⏬ {name}]({ghBuild.LinuxBuildDownloadLink})";
+ else if (shouldHaveArtifacts)
+ {
+ if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
+ linuxDownloadText = "No longer available";
+ }
+
+ // linux arm build
+ name = ghBuild.LinuxArmFilename ?? "Linux ARM64 PR Build";
+ name = name.Replace("rpcs3-", "").Replace("_linux_aarch64", "");
+ if (ghBuild.LinuxArmBuildDownloadLink is { Length: > 0 })
+ linuxArmDownloadText = $"[⏬ {name}]({ghBuild.LinuxArmBuildDownloadLink})";
+ else if (shouldHaveArtifacts)
+ {
+ if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
+ linuxArmDownloadText = "No longer available";
+ }
+
+ // mac build
+ name = ghBuild.MacFilename ?? "Mac PR Build";
+ name = name.Replace("rpcs3-", "").Replace("_macos", "");
+ if (ghBuild.MacBuildDownloadLink is { Length: > 0 })
+ macDownloadText = $"[⏬ {name}]({ghBuild.MacBuildDownloadLink})";
+ else if (shouldHaveArtifacts)
+ {
+ if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
+ macDownloadText = "No longer available";
+ }
+
+ // mac arm build
+ name = ghBuild.MacArmFilename ?? "Mac Apple Silicon PR Build";
+ name = name.Replace("rpcs3-", "").Replace("_macos", "").Replace("_arm64", "");
+ if (ghBuild.MacArmBuildDownloadLink is { Length: > 0 })
+ macArmDownloadText = $"[⏬ {name}]({ghBuild.MacArmBuildDownloadLink})";
+ else if (shouldHaveArtifacts)
+ {
+ if ((DateTime.UtcNow - ghBuild.FinishTime).TotalDays > 30)
+ macArmDownloadText = "No longer available";
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Config.Log.Error(e, "Failed to get CI build info");
+ windowsDownloadText = null; // probably due to expired access token
+ linuxDownloadText = null;
+ macDownloadText = null;
+ windowsArmDownloadText = null;
+ linuxArmDownloadText = null;
+ macArmDownloadText = null;
+ }
+
+ if (!string.IsNullOrEmpty(windowsDownloadText))
+ embed.AddField(windowsDownloadHeader, windowsDownloadText, true);
+ if (!string.IsNullOrEmpty(linuxDownloadText))
+ embed.AddField(linuxDownloadHeader, linuxDownloadText, true);
+ if (!string.IsNullOrEmpty(macDownloadText))
+ embed.AddField(macDownloadHeader, macDownloadText, true);
+ if (!string.IsNullOrEmpty(windowsArmDownloadText))
+ embed.AddField(windowsArmDownloadHeader, windowsArmDownloadText, true);
+ if (!string.IsNullOrEmpty(linuxArmDownloadText))
+ embed.AddField(linuxArmDownloadHeader, linuxArmDownloadText, true);
+ if (!string.IsNullOrEmpty(macArmDownloadText))
+ embed.AddField(macArmDownloadHeader, macArmDownloadText, true);
+ if (!string.IsNullOrEmpty(buildTime))
+ embed.WithFooter(buildTime);
+ }
+ else if (state is "Merged")
+ {
+ var mergeTime = prInfo.MergedAt.GetValueOrDefault();
+ var now = DateTime.UtcNow;
+ var updateInfo = await CompatApiClient.GetUpdateAsync(Config.Cts.Token, linkOld ? prInfo.MergeCommitSha : null).ConfigureAwait(false);
+ if (updateInfo.LatestDatetime is DateTime masterBuildTime && masterBuildTime.Ticks >= mergeTime.Ticks)
+ embed = await updateInfo.AsEmbedAsync(client, false, embed, prInfo, linkOld).ConfigureAwait(false);
+ else
+ {
+ var waitTime = TimeSpan.FromMinutes(5);
+ var avgBuildTime = (await GithubClient.GetPipelineDurationAsync(Config.Cts.Token).ConfigureAwait(false)).Mean;
+ if (now < mergeTime + avgBuildTime)
+ waitTime = mergeTime + avgBuildTime - now;
+ embed.AddField(
+ "Latest master build",
+ $"""
+ This pull request has been merged, and will be part of `master` very soon.
+ Please check again in {waitTime.AsTimeDeltaDescription()}.
+ """
+ );
+ }
+ }
+ return result.AddEmbed(embed);
+ }
+}
diff --git a/CompatBot/Utils/ResultFormatters/UpdateInfoFormatter.cs b/CompatBot/Utils/ResultFormatters/UpdateInfoFormatter.cs
index 3cebd2b9..788da66b 100644
--- a/CompatBot/Utils/ResultFormatters/UpdateInfoFormatter.cs
+++ b/CompatBot/Utils/ResultFormatters/UpdateInfoFormatter.cs
@@ -4,7 +4,6 @@ using CompatApiClient;
using CompatApiClient.POCOs;
using CompatApiClient.Utils;
using CompatBot.EventHandlers;
-using CompatBot.Utils.Extensions;
namespace CompatBot.Utils.ResultFormatters;
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 267b6f8b..df2eb72f 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -7,7 +7,7 @@
-
+