Skip to content

Commit 0d09a6c

Browse files
committed
slack: minor
1 parent 2f0eee5 commit 0d09a6c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lib/slack.ml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ let empty_attachments =
2626
let mrkdwn_of_markdown str = String.strip @@ Mrkdwn.mrkdwn_of_markdown str
2727
let mrkdwn_of_markdown_opt = Option.map ~f:mrkdwn_of_markdown
2828
let escape = Mrkdwn.escape_mrkdwn
29+
let pp_link ~url text = sprintf "<%s|%s>" url (escape text)
2930

3031
let show_labels = function
3132
| [] -> None
@@ -50,8 +51,8 @@ let generate_pull_request_notification notification channel =
5051
)
5152
in
5253
let summary =
53-
sprintf "<%s|[%s]> Pull request #%d <%s|%s> %s by *%s*" repository.url repository.full_name number html_url
54-
(escape title) action sender.login
54+
sprintf "<%s|[%s]> Pull request #%d %s %s by *%s*" repository.url repository.full_name number
55+
(pp_link ~url:html_url title) action sender.login
5556
in
5657
{
5758
channel;
@@ -88,8 +89,8 @@ let generate_pr_review_notification notification channel =
8889
)
8990
in
9091
let summary =
91-
sprintf "<%s|[%s]> *%s* <%s|%s> #%d <%s|%s>" repository.url repository.full_name sender.login review.html_url
92-
action_str number html_url (escape title)
92+
sprintf "<%s|[%s]> *%s* <%s|%s> #%d %s" repository.url repository.full_name sender.login review.html_url
93+
action_str number (pp_link ~url:html_url title)
9394
in
9495
{
9596
channel;
@@ -120,8 +121,8 @@ let generate_pr_review_comment_notification notification channel =
120121
)
121122
in
122123
let summary =
123-
sprintf "<%s|[%s]> *%s* %s on #%d <%s|%s>" repository.url repository.full_name sender.login action_str number
124-
html_url (escape title)
124+
sprintf "<%s|[%s]> *%s* %s on #%d %s" repository.url repository.full_name sender.login action_str number
125+
(pp_link ~url:html_url title)
125126
in
126127
let file =
127128
match comment.path with
@@ -161,7 +162,7 @@ let generate_issue_notification notification channel =
161162
)
162163
in
163164
let summary =
164-
sprintf "<%s|[%s]> Issue #%d <%s|%s> %s by *%s*" repository.url repository.full_name number html_url (escape title)
165+
sprintf "<%s|[%s]> Issue #%d %s %s by *%s*" repository.url repository.full_name number (pp_link ~url:html_url title)
165166
action sender.login
166167
in
167168
{
@@ -194,8 +195,8 @@ let generate_issue_comment_notification notification channel =
194195
)
195196
in
196197
let summary =
197-
sprintf "<%s|[%s]> *%s* <%s|%s> on #%d <%s|%s>" repository.url repository.full_name sender.login comment.html_url
198-
action_str number issue.html_url (escape title)
198+
sprintf "<%s|[%s]> *%s* <%s|%s> on #%d %s" repository.url repository.full_name sender.login comment.html_url
199+
action_str number (pp_link ~url:issue.html_url title)
199200
in
200201
{
201202
channel;
@@ -342,8 +343,8 @@ let generate_commit_comment_notification api_commit notification channel =
342343
| Some c -> c
343344
in
344345
let summary =
345-
sprintf "<%s|[%s]> *%s* commented on `<%s|%s>` %s" repository.url repository.full_name sender.login comment.html_url
346-
(git_short_sha_hash commit_id)
346+
sprintf "<%s|[%s]> *%s* commented on `%s` %s" repository.url repository.full_name sender.login (pp_link ~url:comment.html_url
347+
(git_short_sha_hash commit_id))
347348
(first_line (escape commit.message))
348349
in
349350
let path =

0 commit comments

Comments
 (0)