Skip to content

Commit c078c41

Browse files
committed
escape and only show first line of commit msg
1 parent d55ac63 commit c078c41

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/slack_message.ml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ open Base
22
open Printf
33
open Github_t
44
open Slack_t
5-
6-
let git_short_sha_hash hash = String.sub ~pos:0 ~len:8 hash
5+
open Common
6+
open Mrkdwn
77

88
let empty_attachment =
99
{
@@ -25,14 +25,18 @@ let empty_attachment =
2525
}
2626

2727
let base_attachment (repository : repository) =
28-
{ empty_attachment with footer = Some (sprintf "<%s|%s>" repository.url repository.full_name) }
28+
{ empty_attachment with footer = Some (sprintf "<%s|%s>" repository.url (escape_mrkdwn repository.full_name)) }
2929

3030
let pp_file (file : file) = sprintf "<%s|%s>" file.url (Mrkdwn.escape_mrkdwn file.filename)
3131

3232
let populate_commit repository (commit : api_commit) =
3333
let ({ sha; commit; url; author; files; stats } : api_commit) = commit in
3434
let get_files () = List.map files ~f:pp_file in
35-
let title = sprintf "`<%s|%s>` *%s - %s*" url (git_short_sha_hash sha) commit.message commit.author.name in
35+
let title =
36+
sprintf "`<%s|%s>` *%s - %s*" url (Slack.git_short_sha_hash sha)
37+
(escape_mrkdwn @@ first_line commit.message)
38+
(escape_mrkdwn commit.author.name)
39+
in
3640
let num_change = List.length files in
3741
let changes =
3842
sprintf "%d %s with %d %s and %d %s:" num_change

0 commit comments

Comments
 (0)