From df6ef3d5afbfdb39a9d0050a0d51da173829304e Mon Sep 17 00:00:00 2001 From: okseby Date: Tue, 29 Aug 2023 09:34:00 -0400 Subject: [PATCH 1/3] Remove logging approvals list --- bot/utils.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/bot/utils.go b/bot/utils.go index fc7a693..d76ed7a 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -160,8 +160,6 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { } } - log.Println(approvals) - if reactionCount >= reactionCountGoal { // Merge the pull request merge := &github.PullRequestOptions{ From d8d5f2e9e26c35f7e6419f1fe642556e3c8a57e0 Mon Sep 17 00:00:00 2001 From: okseby Date: Tue, 29 Aug 2023 09:35:39 -0400 Subject: [PATCH 2/3] Ok duplicate voting has been stopped. Also fix current vote message being reprinted after a duplicate vote --- bot/utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bot/utils.go b/bot/utils.go index d76ed7a..0d154bd 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -156,6 +156,8 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { if err != nil { log.Println("Error creating comment:", err) } + + return } } } From ce25b3c9f99227c3641a6e0bc8dac34234fc6190 Mon Sep 17 00:00:00 2001 From: okseby Date: Tue, 29 Aug 2023 09:37:59 -0400 Subject: [PATCH 3/3] Mention user that is being detected for duplicate vote --- bot/utils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/utils.go b/bot/utils.go index 0d154bd..e3341c6 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -147,9 +147,12 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { reactionCount++ approvals[prNumber] = commentAuthor } else { + commentText := "@(#{commentAuthor}) your vote has already been counted :x:" + commentText = strings.Replace(commentText, "(#{commentAuthor})", commentAuthor, 1) + // Respond with a comment comment := &github.IssueComment{ - Body: github.String("Your vote has already been counted :x:"), + Body: github.String(commentText), } _, _, err := client.Issues.CreateComment(ctx, owner, repo, prNumber, comment)