Browse Source

Make a distinction between closed and merged GitHub PRs (#337)

* Make a distinction between closed and merged GitHub PRs

Signed-off-by: Isaiah Inuwa <isaiah.inuwa@gmail.com>

* Use assignment shorthand

Co-authored-by: Kegsay <kegsay@gmail.com>

Co-authored-by: Kegsay <kegsay@gmail.com>
pull/341/head
iinuwa 4 years ago
committed by GitHub
parent
commit
f71f1a078d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      services/github/webhook/webhook.go

8
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 { if p.PullRequest.Assignee != nil && p.PullRequest.Assignee.Login != nil {
actionTarget = fmt.Sprintf(" to %s", *p.PullRequest.Assignee.Login) actionTarget = fmt.Sprintf(" to %s", *p.PullRequest.Assignee.Login)
} }
prAction := *p.Action
if prAction == "closed" && *p.PullRequest.Merged {
prAction = "merged"
}
return fmt.Sprintf( return fmt.Sprintf(
"[<u>%s</u>] %s %s <b>pull request #%d</b>: %s [%s]%s - %s", "[<u>%s</u>] %s %s <b>pull request #%d</b>: %s [%s]%s - %s",
html.EscapeString(*p.Repo.FullName), html.EscapeString(*p.Repo.FullName),
html.EscapeString(*p.Sender.Login), html.EscapeString(*p.Sender.Login),
html.EscapeString(*p.Action),
html.EscapeString(prAction),
*p.Number, *p.Number,
html.EscapeString(*p.PullRequest.Title), html.EscapeString(*p.PullRequest.Title),
html.EscapeString(*p.PullRequest.State), html.EscapeString(*p.PullRequest.State),

Loading…
Cancel
Save