From c9470925679d27842782023b64456b556af1cc3c Mon Sep 17 00:00:00 2001 From: okseby Date: Mon, 28 Aug 2023 20:16:00 -0400 Subject: [PATCH] Ok that didn't work --- bot/utils.go | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/bot/utils.go b/bot/utils.go index 50c4903..e01aff8 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -91,7 +91,6 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { prNumber := event.GetIssue().GetNumber() reactionCount := 0 reactionCountGoal := 5 - approvers := []string{} if event.GetIssue().IsPullRequest() { comments, _, err := client.Issues.ListComments(ctx, owner, repo, prNumber, nil) @@ -103,22 +102,7 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { // Check if there are thumbs up (:+1:) reactions for _, comment := range comments { if strings.Contains(comment.GetBody(), "+1") && !strings.Contains(comment.GetUser().GetLogin(), "bot") { - for _, name := range approvers { - if !strings.Contains(name, comment.GetUser().GetLogin()) { - reactionCount++ - approvers = append(approvers, comment.GetUser().GetLogin()) - } else { - // Respond with a comment - comment := &github.IssueComment{ - Body: github.String("You've already voted!"), - } - - _, _, err := client.Issues.CreateComment(ctx, owner, repo, prNumber, comment) - if err != nil { - log.Println("Error creating comment:", err) - } - } - } + reactionCount++ } } @@ -147,7 +131,7 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { return } else { - commentText := "Current :+1: count is (#{reactionCount}) need (#{reactionRemainingCount}) more to merge" + commentText := "Votes: (#{reactionCount})/(#{reactionRemainingCount})" commentText = strings.Replace(commentText, "(#{reactionCount})", strconv.Itoa(reactionCount), 1) commentText = strings.Replace(commentText, "(#{reactionRemainingCount})", strconv.Itoa(reactionCountGoal-reactionCount), 1)