Merge pull request #38 from rowbawts/dev

Log approvals list for debugging purposes
This commit is contained in:
Sebastian Cabrera 2023-08-29 09:31:31 -04:00 committed by GitHub
commit c01a3f6902
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,6 @@ var itr, _ = ghinstallation.New(http.DefaultTransport, 381312, 41105280, []byte(
// Use installation transport with client. // Use installation transport with client.
var client = github.NewClient(&http.Client{Transport: itr}) var client = github.NewClient(&http.Client{Transport: itr})
var ctx = context.Background() var ctx = context.Background()
var approvals map[int]string
func initGitHubClient() { func initGitHubClient() {
log.Println("Initializing......") log.Println("Initializing......")
@ -106,7 +105,7 @@ func processIssuesEvent(event *github.IssuesEvent) {
issueNumber := event.GetIssue().GetNumber() issueNumber := event.GetIssue().GetNumber()
if event.GetAction() == "opened" { 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 // Respond with a comment
comment := &github.IssueComment{ comment := &github.IssueComment{
@ -126,6 +125,7 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) {
prNumber := event.GetIssue().GetNumber() prNumber := event.GetIssue().GetNumber()
reactionCount := 0 reactionCount := 0
reactionCountGoal := 5 reactionCountGoal := 5
approvals := map[int]string{}
if event.GetIssue().IsPullRequest() { if event.GetIssue().IsPullRequest() {
comments, _, err := client.Issues.ListComments(ctx, owner, repo, prNumber, nil) comments, _, err := client.Issues.ListComments(ctx, owner, repo, prNumber, nil)
@ -160,6 +160,8 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) {
} }
} }
log.Println(approvals)
if reactionCount >= reactionCountGoal { if reactionCount >= reactionCountGoal {
// Merge the pull request // Merge the pull request
merge := &github.PullRequestOptions{ merge := &github.PullRequestOptions{