Ok I think it works now, add message on successful merge

This commit is contained in:
Sebastian Cabrera 2023-08-28 19:18:11 -04:00
parent 2661344d14
commit 6e15e53410

View file

@ -103,8 +103,9 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) {
for _, comment := range comments {
if strings.Contains(comment.GetBody(), "+1") && !strings.Contains(comment.GetUser().GetLogin(), "bot") {
fmt.Println(comment.GetUser().GetLogin())
return
reactionCount++
}
}
if reactionCount >= reactionCountGoal {
// Merge the pull request
@ -112,7 +113,17 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) {
MergeMethod: "merge", // Change this as needed
}
_, _, err := client.PullRequests.Merge(ctx, owner, repo, prNumber, "Merging based on reactions", merge)
// Respond with a comment
comment := &github.IssueComment{
Body: github.String("Merging based on reactions :fireworks:"),
}
_, _, err := client.Issues.CreateComment(ctx, owner, repo, prNumber, comment)
if err != nil {
log.Println("Error creating comment:", err)
}
_, _, err = client.PullRequests.Merge(ctx, owner, repo, prNumber, "Merging based on reactions", merge)
if err != nil {
log.Println("Error merging pull request:", err)
} else {
@ -136,8 +147,6 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) {
}
}
}
}
}
}
func processPullRequestEvent(event *github.PullRequestEvent) {