Update release thread on release

Closes #1328
This commit is contained in:
Dominion
2022-10-08 20:55:38 -04:00
parent 9beec406e1
commit 64d30d1758
2 changed files with 23 additions and 3 deletions
+22 -3
View File
@@ -1,5 +1,4 @@
using Octokit;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -7,6 +6,9 @@ using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using Octokit;
using Octokit.GraphQL;
namespace ReleaseNotes
{
/// <summary>
@@ -44,7 +46,7 @@ namespace ReleaseNotes
try
{
var client = new GitHubClient(new ProductHeaderValue("tgs_release_notes"));
var client = new GitHubClient(new Octokit.ProductHeaderValue("tgs_release_notes"));
if (!String.IsNullOrWhiteSpace(githubToken))
{
client.Credentials = new Credentials(githubToken);
@@ -444,6 +446,23 @@ namespace ReleaseNotes
var releaseNotes = newNotes.ToString();
await File.WriteAllTextAsync(OutputPath, releaseNotes).ConfigureAwait(false);
Console.WriteLine("Updating Server Release Thread...");
var productInformation = new Octokit.GraphQL.ProductHeaderValue("tgs_release_notes");
var connection = new Octokit.GraphQL.Connection(productInformation, githubToken);
var mutation = new Mutation()
.AddDiscussionComment(new Octokit.GraphQL.Model.AddDiscussionCommentInput
{
Body = $"[tgstation-server-v{versionString}](https://github.com/tgstation/tgstation-server/releases/tag/tgstation-server-v{versionString}) released.",
DiscussionId = new ID("MDEwOkRpc2N1c3Npb24zNTU5OTUx")
})
.Select(payload => new
{
payload.ClientMutationId
})
.Compile();
await connection.Run(mutation);
return 0;
}