From 3bd3befdc4e577a14b8c1e5b88126d664658df34 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 17 Feb 2025 22:53:57 -0600 Subject: [PATCH] Address requested changes --- .../Tgstation.Server.Host.Utils.GitLab.GraphQL.csproj | 9 --------- .../Deployment/Remote/BaseRemoteDeploymentManager.cs | 5 +++++ .../Deployment/Remote/GitHubRemoteDeploymentManager.cs | 5 ++--- .../Deployment/Remote/GitLabRemoteDeploymentManager.cs | 5 ++--- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Tgstation.Server.Host.Utils.GitLab.GraphQL/Tgstation.Server.Host.Utils.GitLab.GraphQL.csproj b/src/Tgstation.Server.Host.Utils.GitLab.GraphQL/Tgstation.Server.Host.Utils.GitLab.GraphQL.csproj index 704675f94d..f88dbe6f05 100644 --- a/src/Tgstation.Server.Host.Utils.GitLab.GraphQL/Tgstation.Server.Host.Utils.GitLab.GraphQL.csproj +++ b/src/Tgstation.Server.Host.Utils.GitLab.GraphQL/Tgstation.Server.Host.Utils.GitLab.GraphQL.csproj @@ -32,15 +32,6 @@ - - - - - - - - - diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs index e0cd54a6bb..41705dbc0a 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs @@ -18,6 +18,11 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote /// abstract class BaseRemoteDeploymentManager : IRemoteDeploymentManager { + /// + /// The header comment that begins every deployment message comment/note. + /// + public const string DeploymentMsgHeaderStart = ""; + /// /// The for the . /// diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs index 1fc8656b6e..790b9ea1d3 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs @@ -282,10 +282,9 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote try { - string headerStart = ""; - string header = String.Format(CultureInfo.InvariantCulture, "{1}{0}## Test merge deployment history:{0}{0}", Environment.NewLine, headerStart); + string header = String.Format(CultureInfo.InvariantCulture, "{1}{0}## Test merge deployment history:{0}{0}", Environment.NewLine, DeploymentMsgHeaderStart); - var existingComment = await gitHubService.GetExistingCommentOnIssue(remoteRepositoryOwner, remoteRepositoryName, headerStart, testMergeNumber, cancellationToken); + var existingComment = await gitHubService.GetExistingCommentOnIssue(remoteRepositoryOwner, remoteRepositoryName, DeploymentMsgHeaderStart, testMergeNumber, cancellationToken); if (existingComment != null) { await gitHubService.AppendCommentOnIssue(remoteRepositoryOwner, remoteRepositoryName, comment, existingComment, cancellationToken); diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs index 229c4d470e..51b9e8e891 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs @@ -163,8 +163,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote await using var client = await GraphQLGitLabClientFactory.CreateClient(repositorySettings.AccessToken); try { - string headerStart = ""; - string header = String.Format(CultureInfo.InvariantCulture, "{1}{0}## Test merge deployment history:{0}{0}", Environment.NewLine, headerStart); + string header = String.Format(CultureInfo.InvariantCulture, "{1}{0}## Test merge deployment history:{0}{0}", Environment.NewLine, DeploymentMsgHeaderStart); // Try to find an existing note var notesQueryResult = await client.GraphQL.GetMergeRequestNotes.ExecuteAsync( @@ -188,7 +187,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote for (int i = comments.Count - 1; i > -1; i--) { var currentComment = comments[i]; - if (currentComment?.Author?.Username == repositorySettings.AccessUser && (currentComment?.Body?.StartsWith(headerStart) ?? false)) + if (currentComment?.Author?.Username == repositorySettings.AccessUser && (currentComment?.Body?.StartsWith(DeploymentMsgHeaderStart) ?? false)) { if (currentComment.Body.Length > 987856) { // Limit should be 999,999 so we'll leave a 12,143 buffer