diff --git a/pkg/vcs/github/client.go b/pkg/vcs/github/client.go index 568506b..14721cf 100644 --- a/pkg/vcs/github/client.go +++ b/pkg/vcs/github/client.go @@ -109,11 +109,10 @@ func (c *Client) GetOldRunUrls(prID int, fullName string, rootCommentID int) (st // Github orders comments from earliest -> latest via ID, so we check each comment and take the last match on an "old url" block oldRunBlockTest := utils.CaptureSubstring(comment.GetBody(), utils.URL_RUN_GROUP_PREFIX, utils.URL_RUN_GROUP_SUFFIX) + // Add a new line for the first table entry so that markdown tabling can properly begin + oldRunBlock = "\n" if oldRunBlockTest != "" { oldRunBlock = oldRunBlockTest - } else { - // Add a new line for the first table entry so that markdown tabling can properly begin - oldRunBlock = "\n" } if os.Getenv("TFBUDDY_DELETE_OLD_COMMENTS") != "" && comment.GetID() != int64(rootCommentID) { diff --git a/pkg/vcs/gitlab/client.go b/pkg/vcs/gitlab/client.go index cbc9ff5..96c9a97 100644 --- a/pkg/vcs/gitlab/client.go +++ b/pkg/vcs/gitlab/client.go @@ -153,11 +153,10 @@ func (c *GitlabClient) GetOldRunUrls(mrIID int, project string, rootNoteID int) // Gitlab default sort is order by created by, so take the last match on this oldRunBlockTest := utils.CaptureSubstring(note.Body, utils.URL_RUN_GROUP_PREFIX, utils.URL_RUN_GROUP_SUFFIX) + // Add a new line for the first table entry so that markdown tabling can properly begin + oldRunBlock = "\n" if oldRunBlockTest != "" { oldRunBlock = oldRunBlockTest - } else { - // Add a new line for the first table entry so that markdown tabling can properly begin - oldRunBlock = "\n" } if os.Getenv("TFBUDDY_DELETE_OLD_COMMENTS") != "" && note.ID != rootNoteID { log.Debug().Str("projectID", project).Int("mrIID", mrIID).Msgf("deleting note %d", note.ID)