Skip to content

Commit

Permalink
fix: Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
guerinoni committed Jan 17, 2025
1 parent f2812ea commit 15f4a34
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions pkg/reporter/gh/comment/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,6 @@ func (r *rep) stickyComment(owner string, repo string, id int, comment io.Reader
for _, comment := range comments {
if strings.HasPrefix(*comment.Body, stickyReviewCommentAnnotation) {
commentFn = func() error {
// NOTE: workaround here
// - get the content of the previous comment
// - append the new content
// - update the comment with the new content
// content, _, err := r.ghClient.Issues.GetComment(r.ctx, owner, repo, *comment.ID)
// if err != nil {
// return err
// }

// *issueComment.Body = trimGithubComment(*content.Body + "\n" + *issueComment.Body)

_, _, err = r.ghClient.Issues.EditComment(r.ctx, owner, repo, *comment.ID, issueComment)

return err
Expand All @@ -127,21 +116,6 @@ func (r *rep) stickyComment(owner string, repo string, id int, comment io.Reader
return commentFn()
}

// trimGithubComment removes the title from the comment.
// Right now if multiple pipeline runs on same PRs will post multiple comments, but one edits the previous comment.
// So now it get the comment and append the new one, in this way we can keep one comment but with all information.
// Here we remove the title from the comment, this way is easier to read and cleaner from the user prospective.
func trimGithubComment(body string) string {
toRemove := "**listen.dev runtime monitor detected a potential security issue**"
lastIndex := strings.LastIndex(body, toRemove)
if lastIndex == -1 {
return body
}

// Remove the last occurrence by slicing and concatenating the string.
return body[:lastIndex] + body[lastIndex+len(toRemove):]
}

func (r *rep) Run(res interface{}, _ *string) error {
owner := r.opts.Reporting.GitHub.Owner
repo := r.opts.Reporting.GitHub.Repo
Expand Down

0 comments on commit 15f4a34

Please # to comment.