@@ -619,51 +619,55 @@ ${commentChain}
619
619
`
620
620
}
621
621
622
- // perform review
623
- try {
624
- const [ response ] = await heavyBot . chat (
625
- prompts . renderReviewFileDiff ( ins ) ,
626
- { }
627
- )
628
- if ( response === '' ) {
629
- info ( 'review: nothing obtained from openai' )
630
- reviewsFailed . push ( `${ filename } (no response)` )
631
- return
632
- }
633
- // parse review
634
- const reviews = parseReview ( response , patches , options . debug )
635
- for ( const review of reviews ) {
636
- // check for LGTM
637
- if (
638
- ! options . reviewCommentLGTM &&
639
- ( review . comment . includes ( 'LGTM' ) ||
640
- review . comment . includes ( 'looks good to me' ) )
641
- ) {
642
- continue
643
- }
644
- if ( context . payload . pull_request == null ) {
645
- warning ( 'No pull request found, skipping.' )
646
- continue
622
+ if ( patchesPacked > 0 ) {
623
+ // perform review
624
+ try {
625
+ const [ response ] = await heavyBot . chat (
626
+ prompts . renderReviewFileDiff ( ins ) ,
627
+ { }
628
+ )
629
+ if ( response === '' ) {
630
+ info ( 'review: nothing obtained from openai' )
631
+ reviewsFailed . push ( `${ filename } (no response)` )
632
+ return
647
633
}
634
+ // parse review
635
+ const reviews = parseReview ( response , patches , options . debug )
636
+ for ( const review of reviews ) {
637
+ // check for LGTM
638
+ if (
639
+ ! options . reviewCommentLGTM &&
640
+ ( review . comment . includes ( 'LGTM' ) ||
641
+ review . comment . includes ( 'looks good to me' ) )
642
+ ) {
643
+ continue
644
+ }
645
+ if ( context . payload . pull_request == null ) {
646
+ warning ( 'No pull request found, skipping.' )
647
+ continue
648
+ }
648
649
649
- try {
650
- await commenter . bufferReviewComment (
651
- filename ,
652
- review . startLine ,
653
- review . endLine ,
654
- `${ review . comment } `
655
- )
656
- } catch ( e : any ) {
657
- reviewsFailed . push ( `${ filename } comment failed (${ e as string } )` )
650
+ try {
651
+ await commenter . bufferReviewComment (
652
+ filename ,
653
+ review . startLine ,
654
+ review . endLine ,
655
+ `${ review . comment } `
656
+ )
657
+ } catch ( e : any ) {
658
+ reviewsFailed . push ( `${ filename } comment failed (${ e as string } )` )
659
+ }
658
660
}
661
+ } catch ( e : any ) {
662
+ warning (
663
+ `Failed to review: ${ e as string } , skipping. backtrace: ${
664
+ e . stack as string
665
+ } `
666
+ )
667
+ reviewsFailed . push ( `${ filename } (${ e as string } )` )
659
668
}
660
- } catch ( e : any ) {
661
- warning (
662
- `Failed to review: ${ e as string } , skipping. backtrace: ${
663
- e . stack as string
664
- } `
665
- )
666
- reviewsFailed . push ( `${ filename } (${ e as string } )` )
669
+ } else {
670
+ reviewsSkipped . push ( `${ filename } (diff too large)` )
667
671
}
668
672
}
669
673
0 commit comments