From f71f1a078d469333a4e10a934947eaf0e22e0d2e Mon Sep 17 00:00:00 2001 From: iinuwa Date: Fri, 2 Oct 2020 06:11:52 -0500 Subject: [PATCH] Make a distinction between closed and merged GitHub PRs (#337) * Make a distinction between closed and merged GitHub PRs Signed-off-by: Isaiah Inuwa * Use assignment shorthand Co-authored-by: Kegsay Co-authored-by: Kegsay --- services/github/webhook/webhook.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/github/webhook/webhook.go b/services/github/webhook/webhook.go index d639ab7..dd8ccea 100644 --- a/services/github/webhook/webhook.go +++ b/services/github/webhook/webhook.go @@ -155,11 +155,17 @@ func pullRequestHTMLMessage(p github.PullRequestEvent) string { if p.PullRequest.Assignee != nil && p.PullRequest.Assignee.Login != nil { actionTarget = fmt.Sprintf(" to %s", *p.PullRequest.Assignee.Login) } + + prAction := *p.Action + if prAction == "closed" && *p.PullRequest.Merged { + prAction = "merged" + } + return fmt.Sprintf( "[%s] %s %s pull request #%d: %s [%s]%s - %s", html.EscapeString(*p.Repo.FullName), html.EscapeString(*p.Sender.Login), - html.EscapeString(*p.Action), + html.EscapeString(prAction), *p.Number, html.EscapeString(*p.PullRequest.Title), html.EscapeString(*p.PullRequest.State),