@@ -76,12 +76,12 @@ let generate_pull_request_notification notification channel =
76
76
blocks = None ;
77
77
}
78
78
79
- let generate_pr_review_notification notification channel =
79
+ let generate_pr_review_notification ( ctx : Context.t ) notification channel =
80
80
let { action; sender; pull_request; review; repository } = notification in
81
81
let ({ number; title; html_url; _ } : pull_request ) = pull_request in
82
82
let action_str =
83
83
match action with
84
- | Submitted ->
84
+ | Submitted | Edited ->
85
85
( match review.state with
86
86
| "commented" -> " commented on"
87
87
| "approved" -> " approved"
@@ -98,22 +98,26 @@ let generate_pr_review_notification notification channel =
98
98
sprintf " <%s|[%s]> *%s* <%s|%s> #%d %s" repository.url repository.full_name sender.login review.html_url action_str
99
99
number (pp_link ~url: html_url title)
100
100
in
101
- New_message
102
- {
103
- channel;
104
- text = Some summary;
105
- attachments =
106
- Some
107
- [
108
- {
109
- empty_attachments with
110
- mrkdwn_in = Some [ " text" ];
111
- color = Some " #ccc" ;
112
- text = mrkdwn_of_markdown_opt review.body;
113
- };
114
- ];
115
- blocks = None ;
116
- }
101
+ let attachments =
102
+ Some
103
+ [
104
+ {
105
+ empty_attachments with
106
+ mrkdwn_in = Some [ " text" ];
107
+ color = Some " #ccc" ;
108
+ text = mrkdwn_of_markdown_opt review.body;
109
+ };
110
+ ]
111
+ in
112
+ match action with
113
+ | Submitted -> New_message { channel; text = Some summary; attachments; blocks = None }
114
+ | Edited ->
115
+ ( match State. get_review_map ctx.state repository.url review.id with
116
+ | Some ({ channel; ts } : post_message_res ) ->
117
+ Update_message { channel; ts; text = Some summary; attachments; blocks = None }
118
+ | None -> invalid_arg (sprintf " could not find comment %d in %s" review.id repository.url)
119
+ )
120
+ | _ -> invalid_arg " impossible"
117
121
118
122
let generate_pr_review_comment_notification (ctx : Context.t ) notification channel =
119
123
let { action; pull_request; sender; comment; repository } = notification in
0 commit comments