@@ -23,6 +23,7 @@ import type {
2323
2424type PrReviewActivityWebhookPayload =
2525 | WebhookIssueCommentCreated
26+ | WebhookIssueCommentEdited
2627 | WebhookPullRequestReviewSubmitted
2728 | WebhookPullRequestCommentCreated ;
2829
@@ -31,6 +32,12 @@ type PrReviewSummaryWebhookPayload =
3132 | WebhookIssueCommentEdited ;
3233
3334const MAX_SUMMARY_LENGTH = 300 ;
35+ const MAX_REVIEW_BODY_LENGTH = 10_000 ;
36+
37+ function getReviewBody ( value : string | null | undefined ) : string | undefined {
38+ const body = value ?. trim ( ) ;
39+ return body ? body . slice ( 0 , MAX_REVIEW_BODY_LENGTH ) : undefined ;
40+ }
3441
3542function getAutomatedAuthorMetadata (
3643 user : { id ?: number ; type ?: string } | null | undefined ,
@@ -72,6 +79,7 @@ export function buildPrReviewActivityNotificationInput(
7279
7380 const comment = eventPayload . comment ;
7481 const authorLogin = comment . user ?. login ;
82+ const body = getReviewBody ( comment . body ) ;
7583
7684 if (
7785 ! authorLogin ||
@@ -89,11 +97,12 @@ export function buildPrReviewActivityNotificationInput(
8997 sourceControlProvider : 'github' ,
9098 event : {
9199 kind : 'issue_comment' ,
92- providerEventId : `github-issue-comment:${ comment . id } ` ,
100+ providerEventId : `github-issue-comment:${ comment . id } : ${ comment . updated_at ?? comment . created_at } ` ,
93101 authorLogin,
94102 ...getAutomatedAuthorMetadata ( comment . user ) ,
103+ ...( body ? { body } : { } ) ,
95104 ...( comment . html_url ? { url : comment . html_url } : { } ) ,
96- observedAt : getObservedAt ( comment . created_at ) ,
105+ observedAt : getObservedAt ( comment . updated_at ?? comment . created_at ) ,
97106 } ,
98107 } ;
99108 }
@@ -108,6 +117,7 @@ export function buildPrReviewActivityNotificationInput(
108117 if ( 'review' in eventPayload ) {
109118 const review = eventPayload . review ;
110119 const authorLogin = review . user ?. login ;
120+ const body = getReviewBody ( review . body ) ;
111121
112122 if ( ! authorLogin ) {
113123 return null ;
@@ -128,6 +138,7 @@ export function buildPrReviewActivityNotificationInput(
128138 providerEventId : `github-review:${ review . id } ` ,
129139 authorLogin,
130140 ...getAutomatedAuthorMetadata ( review . user ) ,
141+ ...( body ? { body } : { } ) ,
131142 ...( review . commit_id ? { reviewHeadSha : review . commit_id } : { } ) ,
132143 batchId : `github-review:${ review . id } ` ,
133144 reviewState : review . state ,
@@ -144,6 +155,7 @@ export function buildPrReviewActivityNotificationInput(
144155
145156 const comment = eventPayload . comment ;
146157 const authorLogin = comment . user ?. login ;
158+ const body = getReviewBody ( comment . body ) ;
147159
148160 if ( ! authorLogin ) {
149161 return null ;
@@ -167,6 +179,10 @@ export function buildPrReviewActivityNotificationInput(
167179 providerEventId : `github-review-comment:${ comment . id } ` ,
168180 authorLogin,
169181 ...getAutomatedAuthorMetadata ( comment . user ) ,
182+ ...( comment . in_reply_to_id
183+ ? { inReplyToId : String ( comment . in_reply_to_id ) }
184+ : { } ) ,
185+ ...( body ? { body } : { } ) ,
170186 ...( comment . commit_id ? { reviewHeadSha : comment . commit_id } : { } ) ,
171187 ...( comment . pull_request_review_id
172188 ? { batchId : `github-review:${ comment . pull_request_review_id } ` }
0 commit comments