Merge pull request #37 from rowbawts/dev

Code cleanup
This commit is contained in:
Sebastian Cabrera 2023-08-29 09:24:13 -04:00 committed by GitHub
commit 01e6b69770
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,11 +136,16 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) {
// Check if there are thumbs up (:+1:) reactions // Check if there are thumbs up (:+1:) reactions
for _, comment := range comments { for _, comment := range comments {
if strings.Contains(comment.GetBody(), "+1") && !strings.Contains(comment.GetUser().GetLogin(), "bot") { commentAuthor := comment.GetUser().GetLogin()
if strings.Contains(comment.GetBody(), "+1") && !strings.Contains(commentAuthor, "bot") {
value, exists := approvals[prNumber] value, exists := approvals[prNumber]
if !(exists && strings.Contains(value, comment.GetUser().GetLogin())) { if exists && !strings.Contains(value, commentAuthor) {
reactionCount++ reactionCount++
approvals[prNumber] = comment.GetUser().GetLogin() approvals[prNumber] = commentAuthor
} else if !exists {
reactionCount++
approvals[prNumber] = commentAuthor
} else { } else {
// Respond with a comment // Respond with a comment
comment := &github.IssueComment{ comment := &github.IssueComment{