Ok I think it works now, add message on successful merge
This commit is contained in:
parent
2661344d14
commit
6e15e53410
1 changed files with 35 additions and 26 deletions
17
bot/utils.go
17
bot/utils.go
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue