mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 07:38:05 +01:00
Fix issues when creating Discord Discussions on PRs with dummy long titles (#87768)
This commit is contained in:
@@ -174,7 +174,7 @@ namespace Tgstation.DiscordDiscussions
|
||||
var isReopen = Boolean.Parse(args[7]);
|
||||
var joinLink = args.Length > 8 ? args[8] : null;
|
||||
|
||||
var prTitle = Environment.GetEnvironmentVariable("GITHUB_PULL_REQUEST_TITLE");
|
||||
var prTitle = Environment.GetEnvironmentVariable("GITHUB_PULL_REQUEST_TITLE")!;
|
||||
|
||||
var gitHubClient = new GitHubClient(new ProductHeaderValue("Tgstation.DiscordDiscussions"))
|
||||
{
|
||||
@@ -214,6 +214,12 @@ namespace Tgstation.DiscordDiscussions
|
||||
var prLink = $"https://github.com/{repoOwner}/{repoName}/pull/{prNumber}";
|
||||
var messageContent = $"#{prNumber} - {prTitle}";
|
||||
|
||||
// thread titles can only be 100 long
|
||||
if (messageContent.Length > 100)
|
||||
{
|
||||
messageContent = $"#{prNumber} - {prTitle[..^(messageContent.Length - 97)]}...";
|
||||
}
|
||||
|
||||
var channelsClient = serviceProvider.GetRequiredService<IDiscordRestChannelAPI>();
|
||||
|
||||
var channelId = new Snowflake(discussionsChannelId);
|
||||
|
||||
Reference in New Issue
Block a user