@@ -194,68 +194,70 @@ ${COMMENT_TAG}`
194
194
info (
195
195
`Submitting review for PR #${ pullNumber } , total comments: ${ this . reviewCommentsBuffer . length } `
196
196
)
197
- try {
198
- let commentCounter = 0
199
- for ( const comment of this . reviewCommentsBuffer ) {
200
- info ( `Posting comment: ${ comment . message } ` )
201
- let found = false
202
- const comments = await this . getCommentsAtRange (
203
- pullNumber ,
204
- comment . path ,
205
- comment . startLine ,
206
- comment . endLine
207
- )
208
- for ( const c of comments ) {
209
- if ( c . body . includes ( COMMENT_TAG ) ) {
210
- info (
211
- `Updating review comment for ${ comment . path } : ${ comment . startLine } - ${ comment . endLine } : ${ comment . message } `
212
- )
197
+ let commentCounter = 0
198
+ for ( const comment of this . reviewCommentsBuffer ) {
199
+ info ( `Posting comment: ${ comment . message } ` )
200
+ let found = false
201
+ const comments = await this . getCommentsAtRange (
202
+ pullNumber ,
203
+ comment . path ,
204
+ comment . startLine ,
205
+ comment . endLine
206
+ )
207
+ for ( const c of comments ) {
208
+ if ( c . body . includes ( COMMENT_TAG ) ) {
209
+ info (
210
+ `Updating review comment for ${ comment . path } : ${ comment . startLine } - ${ comment . endLine } : ${ comment . message } `
211
+ )
212
+ try {
213
213
await octokit . pulls . updateReviewComment ( {
214
214
owner : repo . owner ,
215
215
repo : repo . repo ,
216
216
// eslint-disable-next-line camelcase
217
217
comment_id : c . id ,
218
218
body : comment . message
219
219
} )
220
- found = true
221
- break
220
+ } catch ( e ) {
221
+ warning ( `Failed to update review comment: ${ e } ` )
222
222
}
223
+ found = true
224
+ break
223
225
}
226
+ }
224
227
225
- if ( ! found ) {
226
- info (
227
- `Creating new review comment for ${ comment . path } :${ comment . startLine } -${ comment . endLine } : ${ comment . message } `
228
- )
229
- const commentData : any = {
230
- owner : repo . owner ,
231
- repo : repo . repo ,
232
- // eslint-disable-next-line camelcase
233
- pull_number : pullNumber ,
234
- // eslint-disable-next-line camelcase
235
- commit_id : commitId ,
236
- body : comment . message ,
237
- path : comment . path ,
238
- line : comment . endLine
239
- }
240
-
241
- if ( comment . startLine !== comment . endLine ) {
242
- // eslint-disable-next-line camelcase
243
- commentData . start_side = 'RIGHT'
244
- // eslint-disable-next-line camelcase
245
- commentData . start_line = comment . startLine
246
- }
228
+ if ( ! found ) {
229
+ info (
230
+ `Creating new review comment for ${ comment . path } :${ comment . startLine } -${ comment . endLine } : ${ comment . message } `
231
+ )
232
+ const commentData : any = {
233
+ owner : repo . owner ,
234
+ repo : repo . repo ,
235
+ // eslint-disable-next-line camelcase
236
+ pull_number : pullNumber ,
237
+ // eslint-disable-next-line camelcase
238
+ commit_id : commitId ,
239
+ body : comment . message ,
240
+ path : comment . path ,
241
+ line : comment . endLine
242
+ }
247
243
244
+ if ( comment . startLine !== comment . endLine ) {
245
+ // eslint-disable-next-line camelcase
246
+ commentData . start_side = 'RIGHT'
247
+ // eslint-disable-next-line camelcase
248
+ commentData . start_line = comment . startLine
249
+ }
250
+ try {
248
251
await octokit . pulls . createReviewComment ( commentData )
252
+ } catch ( e ) {
253
+ warning ( `Failed to create review comment: ${ e } ` )
249
254
}
250
-
251
- commentCounter ++
252
- info (
253
- `Comment ${ commentCounter } /${ this . reviewCommentsBuffer . length } posted`
254
- )
255
255
}
256
- } catch ( e ) {
257
- warning ( `Failed to submit review: ${ e } ` )
258
- throw e
256
+
257
+ commentCounter ++
258
+ info (
259
+ `Comment ${ commentCounter } /${ this . reviewCommentsBuffer . length } posted`
260
+ )
259
261
}
260
262
}
261
263
0 commit comments