@@ -53,6 +53,9 @@ let generate_pull_request_notification notification channel =
53
53
(sprintf " <%s|[%s]> Pull request #%d <%s|%s> %s by *%s*" repository.url repository.full_name number html_url title
54
54
action sender.login)
55
55
in
56
+ let fallback =
57
+ Some (sprintf " [%s] Pull request #%d %s %s by %s" repository.full_name number title action sender.login)
58
+ in
56
59
{
57
60
channel;
58
61
text = None ;
@@ -62,7 +65,7 @@ let generate_pull_request_notification notification channel =
62
65
{
63
66
empty_attachments with
64
67
mrkdwn_in = Some [ " text" ];
65
- fallback = summary ;
68
+ fallback;
66
69
color = Some " #ccc" ;
67
70
pretext = summary;
68
71
text = mrkdwn_of_markdown_opt body;
@@ -93,6 +96,7 @@ let generate_pr_review_notification notification channel =
93
96
(sprintf " <%s|[%s]> *%s* <%s|%s> #%d <%s|%s>" repository.url repository.full_name sender.login review.html_url
94
97
action_str number html_url title)
95
98
in
99
+ let fallback = Some (sprintf " [%s] %s %s #%d %s" repository.full_name sender.login action_str number title) in
96
100
{
97
101
channel;
98
102
text = None ;
@@ -102,7 +106,7 @@ let generate_pr_review_notification notification channel =
102
106
{
103
107
empty_attachments with
104
108
mrkdwn_in = Some [ " text" ];
105
- fallback = summary ;
109
+ fallback;
106
110
color = Some " #ccc" ;
107
111
pretext = summary;
108
112
text = mrkdwn_of_markdown_opt review.body;
@@ -127,6 +131,7 @@ let generate_pr_review_comment_notification notification channel =
127
131
(sprintf " <%s|[%s]> *%s* %s on #%d <%s|%s>" repository.url repository.full_name sender.login action_str number
128
132
html_url title)
129
133
in
134
+ let fallback = Some (sprintf " [%s] %s %s on #%d %s" repository.full_name sender.login action_str number title) in
130
135
let file =
131
136
match comment.path with
132
137
| None -> None
@@ -141,7 +146,7 @@ let generate_pr_review_comment_notification notification channel =
141
146
{
142
147
empty_attachments with
143
148
mrkdwn_in = Some [ " text" ];
144
- fallback = summary ;
149
+ fallback;
145
150
color = Some " #ccc" ;
146
151
pretext = summary;
147
152
footer = file;
@@ -170,6 +175,7 @@ let generate_issue_notification notification channel =
170
175
(sprintf " <%s|[%s]> Issue #%d <%s|%s> %s by *%s*" repository.url repository.full_name number html_url title action
171
176
sender.login)
172
177
in
178
+ let fallback = Some (sprintf " [%s] Issue #%d %s %s by %s" repository.full_name number title action sender.login) in
173
179
{
174
180
channel;
175
181
text = None ;
@@ -179,7 +185,7 @@ let generate_issue_notification notification channel =
179
185
{
180
186
empty_attachments with
181
187
mrkdwn_in = Some [ " text" ];
182
- fallback = summary ;
188
+ fallback;
183
189
color = Some " #ccc" ;
184
190
pretext = summary;
185
191
text = mrkdwn_of_markdown_opt body;
@@ -205,6 +211,7 @@ let generate_issue_comment_notification notification channel =
205
211
(sprintf " <%s|[%s]> *%s* <%s|%s> on #%d <%s|%s>" repository.url repository.full_name sender.login comment.html_url
206
212
action_str number issue.html_url title)
207
213
in
214
+ let fallback = Some (sprintf " [%s] %s %s on #%d %s" repository.full_name sender.login action_str number title) in
208
215
{
209
216
channel;
210
217
text = None ;
@@ -214,7 +221,7 @@ let generate_issue_comment_notification notification channel =
214
221
{
215
222
empty_attachments with
216
223
mrkdwn_in = Some [ " text" ];
217
- fallback = summary ;
224
+ fallback;
218
225
color = Some " #ccc" ;
219
226
pretext = summary;
220
227
text = Some (mrkdwn_of_markdown comment.body);
@@ -243,21 +250,34 @@ let generate_push_notification notification channel =
243
250
(if created then " to new branch " else " " )
244
251
sender.login
245
252
in
253
+ let fallback =
254
+ if deleted then sprintf " [%s] %s deleted branch %s" repository.name sender.login commits_branch
255
+ else
256
+ sprintf " [%s:%s] %i commit%s %spushed %sby %s" repository.name commits_branch (List. length commits)
257
+ ( match commits with
258
+ | [ _ ] -> " "
259
+ | _ -> " s"
260
+ )
261
+ (if forced then " force-" else " " )
262
+ (if created then " to new branch " else " " )
263
+ sender.login
264
+ in
246
265
let commits =
247
266
List. map commits ~f: (fun { url; id; message; author; _ } ->
248
267
let title = first_line message in
249
268
sprintf " `<%s|%s>` %s - %s" url (git_short_sha_hash id) title author.name)
250
269
in
251
270
{
252
271
channel;
253
- text = Some title ;
272
+ text = None ;
254
273
attachments =
255
274
Some
256
275
[
257
276
{
258
277
empty_attachments with
259
278
mrkdwn_in = Some [ " fields" ];
260
- fallback = Some " Commit pushed notification" ;
279
+ pretext = Some title;
280
+ fallback = Some fallback;
261
281
color = Some " #ccc" ;
262
282
fields = Some [ { value = String. concat ~sep: " \n " commits; title = None ; short = false } ];
263
283
};
@@ -315,12 +335,19 @@ let generate_status_notification (cfg : Config_t.config) (notification : status_
315
335
(sprintf " <%s|[%s]> CI Build Status notification for <%s|%s>: %s" repository.url repository.full_name t context
316
336
state_info)
317
337
in
338
+ let fallback =
339
+ match target_url with
340
+ | None ->
341
+ Some (sprintf " [%s] CI Build Status notification: %s" repository.full_name state_info)
342
+ (* in case the CI run is not using buildkite *)
343
+ | Some _ -> Some (sprintf " [%s] CI Build Status notification for %s: %s" repository.full_name context state_info)
344
+ in
318
345
let msg = String. concat ~sep: " \n " @@ List. concat [ commit_info; branches_info ] in
319
346
let attachment =
320
347
{
321
348
empty_attachments with
322
349
mrkdwn_in = Some [ " fields" ; " text" ];
323
- fallback = summary ;
350
+ fallback;
324
351
pretext = summary;
325
352
color = Some color_info;
326
353
text = description_info;
@@ -342,6 +369,11 @@ let generate_commit_comment_notification api_commit notification channel =
342
369
(sprintf " <%s|[%s]> *%s* commented on `<%s|%s>` %s" repository.url repository.full_name sender.login
343
370
comment.html_url (git_short_sha_hash commit_id) (first_line commit.message))
344
371
in
372
+ let fallback =
373
+ Some
374
+ (sprintf " [%s] %s commented on `%s` %s" repository.full_name sender.login (git_short_sha_hash commit_id)
375
+ (first_line commit.message))
376
+ in
345
377
let path =
346
378
match comment.path with
347
379
| None -> None
@@ -351,7 +383,7 @@ let generate_commit_comment_notification api_commit notification channel =
351
383
{
352
384
empty_attachments with
353
385
mrkdwn_in = Some [ " pretext" ; " text" ];
354
- fallback = summary ;
386
+ fallback;
355
387
color = Some " #ccc" ;
356
388
pretext = summary;
357
389
footer = path;
0 commit comments