From efbd35d2f0309bab916fc68aa0b9157d8092bc38 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 7 Jun 2025 12:12:29 -0400 Subject: [PATCH] Improves the PR announcement message grammar (#91509) ## About The Pull Request This makes it so the PR announcements have better grammar: they'll actually say "Pull Request merged by [user]: ..." instead of the current "Pull Request merged [user]: ..." also got rid of a weird extra space i've barely coded C# in a while so this prolly sucks, sorry. ## Why It's Good For The Game because "Pull Request merged Absolucy" annoys me. ## Changelog :cl: spellcheck: PR announcements should now say "X merged by Y: ..." instead of "X merged Y: ..." /:cl: --- tools/Tgstation.PRAnnouncer/PRAnnounceQuery.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/Tgstation.PRAnnouncer/PRAnnounceQuery.cs b/tools/Tgstation.PRAnnouncer/PRAnnounceQuery.cs index 6a47357277c..e3426e7c213 100644 --- a/tools/Tgstation.PRAnnouncer/PRAnnounceQuery.cs +++ b/tools/Tgstation.PRAnnouncer/PRAnnounceQuery.cs @@ -46,7 +46,13 @@ namespace Tgstation.PRAnnouncer PullRequest = new PRAnnouncePayloadPullRequest(pullRequestEvent.PullRequest), }; - announce = $"[{pullRequestEvent.PullRequest.Base.Repo.FullName}] Pull Request {(pullRequestEvent.PullRequest.Merged == true ? "merged" : (pullRequestEvent.Action ?? "(NULL ACTION)"))} {HtmlEncoder.Default.Encode(pullRequestEvent.Sender?.Login ?? "(NULL)")}: #{pullRequestEvent.PullRequest.Number} {HtmlEncoder.Default.Encode($"{pullRequestEvent.PullRequest.User.Login} - {pullRequestEvent.PullRequest.Title}")}"; + var action = pullRequestEvent.PullRequest.Merged == true ? "merged" : pullRequestEvent.Action; + if (action != null && pullRequestEvent.Sender?.Login != null) + { + action += $" by {HtmlEncoder.Default.Encode(pullRequestEvent.Sender.Login)}"; + } + + announce = $"[{pullRequestEvent.PullRequest.Base.Repo.FullName}] Pull Request {action ?? "(NULL ACTION)"}: #{pullRequestEvent.PullRequest.Number} {HtmlEncoder.Default.Encode($"{pullRequestEvent.PullRequest.User.Login} - {pullRequestEvent.PullRequest.Title}")}"; } ///