Skip to content

Commit

Permalink
Render intermediate changelog to output
Browse files Browse the repository at this point in the history
When changelog requested.
  • Loading branch information
kzu committed Oct 31, 2024
1 parent 70a6194 commit e7c3a2c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/File/GitHub.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -202,7 +203,7 @@ public static void WriteChanges(string changelog, ISet<FileSpec> changes)
tasks[change] = ctx.AddTask($"[blue]{filename}[/]");
}
group.AsParallel().ForAll(change =>
group.AsParallel().WithDegreeOfParallelism(Debugger.IsAttached ? 1 : Environment.ProcessorCount).ForAll(change =>
{
var task = tasks[change];
if (compared.Contains((change.Sha, change.NewSha)))
Expand Down Expand Up @@ -267,6 +268,7 @@ commitJson is JObject commitObj &&
});

output.AppendLine($"# {group.Key}").AppendLine();
ColorConsole.WriteLine($"# {group.Key}".Gray());

// GitHub REST API does not seem to handle unicode the same way the website
// does. Unicode emoji shows up perfectly fine on the web (see https://github.com/devlooped/oss/commits/main/.github/workflows/build.yml)
Expand Down Expand Up @@ -300,11 +302,15 @@ static string removeUnicodeEmoji(string message)
};

foreach (var (sha, date, message) in commits)
output.AppendLine($"- {removeUnicodeEmoji(message).Trim()} https://github.com/{group.Key}/commit/{sha[..7]}");
{
var line = $"- {removeUnicodeEmoji(message).Trim()} https://github.com/{group.Key}/commit/{sha[..7]}";
output.AppendLine(line);
ColorConsole.WriteLine(line.Gray());
}

output.AppendLine();
}

File.WriteAllText(changelog, output.ToString(), Encoding.UTF8);
}
}
}

0 comments on commit e7c3a2c

Please sign in to comment.