From cf8a2da467e299d5b063e0cd979a9b6cbfcada67 Mon Sep 17 00:00:00 2001 From: okseby Date: Tue, 29 Aug 2023 09:28:00 -0400 Subject: [PATCH 1/2] Log approvals list for debugging purposes --- bot/utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bot/utils.go b/bot/utils.go index 9e98ebf..1438141 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -106,7 +106,7 @@ func processIssuesEvent(event *github.IssuesEvent) { issueNumber := event.GetIssue().GetNumber() if event.GetAction() == "opened" { - commentText := "Thanks for opening this issue!" + commentText := "Thanks for opening this issue! Someone will be responding soon! :smile:" // Respond with a comment comment := &github.IssueComment{ @@ -160,6 +160,8 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { } } + log.Println(approvals) + if reactionCount >= reactionCountGoal { // Merge the pull request merge := &github.PullRequestOptions{ From 2e1bbe88dced4147109158065087de0d2204e08c Mon Sep 17 00:00:00 2001 From: okseby Date: Tue, 29 Aug 2023 09:31:16 -0400 Subject: [PATCH 2/2] Fix map for approvals list --- bot/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/utils.go b/bot/utils.go index 1438141..fc7a693 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -22,7 +22,6 @@ var itr, _ = ghinstallation.New(http.DefaultTransport, 381312, 41105280, []byte( // Use installation transport with client. var client = github.NewClient(&http.Client{Transport: itr}) var ctx = context.Background() -var approvals map[int]string func initGitHubClient() { log.Println("Initializing......") @@ -126,6 +125,7 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { prNumber := event.GetIssue().GetNumber() reactionCount := 0 reactionCountGoal := 5 + approvals := map[int]string{} if event.GetIssue().IsPullRequest() { comments, _, err := client.Issues.ListComments(ctx, owner, repo, prNumber, nil)