Skip to content

Commit

Permalink
Make comments author depend on project properties
Browse files Browse the repository at this point in the history
This will allow dotnet-retest to report on its own.
  • Loading branch information
kzu committed Jul 16, 2024
1 parent b4438b4 commit 49654c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/dotnet-trx/TrxCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Xml.Linq;
using Devlooped.Web;
using Humanizer;
using NuGet.Common;
using Spectre.Console;
using Spectre.Console.Cli;
using static Devlooped.Process;
Expand All @@ -23,6 +24,9 @@ public partial class TrxCommand : Command<TrxCommand.TrxSettings>
const string Footer = "<!-- footer -->";
const string Signature = "<!-- trx -->";

static string Author =>
$"from [{ThisAssembly.Project.PackageId}]({ThisAssembly.Project.PackageProjectUrl}) on {RuntimeInformation.FrameworkDescription} with [:purple_heart:](https://github.com/sponsors/devlooped)");

public interface ITrxSettings
{
bool GitHubComment { get; init; }
Expand Down Expand Up @@ -342,22 +346,21 @@ static StringBuilder AppendBadges(Summary summary, StringBuilder builder, string
{
sb.AppendLine(body[..start].TrimEnd());
AppendBadges(summary, sb, elapsed, jobUrl);
sb.AppendLine(body[start..end].Trim());
sb.AppendLine();
sb.Append(details);
sb.AppendLine();
sb.AppendLine(body[end..].TrimStart());
sb.AppendLine(body[start..end].Trim())
.AppendLine()
.Append(details)
.AppendLine()
.AppendLine(body[end..].TrimStart());
}
else
{
AppendBadges(summary, sb, elapsed, jobUrl);
sb.AppendLine(Header);
sb.AppendLine();
sb.Append(details);
sb.AppendLine(Footer);
sb.AppendLine();
sb.AppendLine(
$"from [dotnet-trx](https://github.com/devlooped/dotnet-trx) on {RuntimeInformation.FrameworkDescription} with [:purple_heart:](https://github.com/sponsors/devlooped)");
sb.AppendLine(Header)
.AppendLine()
.Append(details)
.AppendLine(Footer)
.AppendLine()
.AppendLine(Author);
}

body = sb.ToString().Trim();
Expand Down Expand Up @@ -393,7 +396,7 @@ static StringBuilder AppendBadges(Summary summary, StringBuilder builder, string
.AppendLine()
.Append(details)
.AppendLine()
.AppendLine($"from [dotnet-trx](https://github.com/devlooped/dotnet-trx) on {RuntimeInformation.FrameworkDescription} with [:purple_heart:](https://github.com/sponsors/devlooped)")
.AppendLine(Author)
.ToString());
}
}
Expand Down
1 change: 1 addition & 0 deletions src/dotnet-trx/dotnet-trx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<ProjectProperty Include="BuildRef" />
<ProjectProperty Include="PackageId" />
<ProjectProperty Include="PackageVersion" />
<ProjectProperty Include="PackageProjectUrl" />
</ItemGroup>

</Project>

0 comments on commit 49654c5

Please sign in to comment.