@@ -358,6 +358,7 @@ export const robot = (app: Probot) => {
358358
359359 // Fetch PR-wide file patches to compute accurate review comment positions
360360 let prFilePatchByPath = new Map < string , string > ( ) ;
361+ let commentablePaths = new Set < string > ( ) ;
361362 try {
362363 const prFiles = await context . octokit . pulls . listFiles ( {
363364 owner : repo . owner ,
@@ -368,6 +369,7 @@ export const robot = (app: Probot) => {
368369 for ( const f of prFiles . data as any [ ] ) {
369370 if ( f && typeof f . patch === "string" ) {
370371 prFilePatchByPath . set ( f . filename , f . patch as string ) ;
372+ commentablePaths . add ( f . filename ) ;
371373 }
372374 }
373375 } catch ( e ) {
@@ -414,6 +416,10 @@ export const robot = (app: Probot) => {
414416 }
415417
416418 if ( ! res . lgtm || ( res . lgtm && REVIEW_ON_LGTM ) ) {
419+ if ( ! commentablePaths . has ( file . filename ) ) {
420+ log . info ( `PR 파일에 patch가 없어 ${ file . filename } 에 대한 코멘트 생략` ) ;
421+ continue ;
422+ }
417423 // Compute position against the PR-wide patch to avoid misalignment
418424 const prWidePatch = prFilePatchByPath . get ( file . filename ) || patch ;
419425 const position = firstChangedPosition ( prWidePatch ) ;
@@ -423,8 +429,16 @@ export const robot = (app: Probot) => {
423429 position,
424430 } ) ;
425431 }
426- } catch ( e ) {
427- log . info ( `review ${ file . filename } failed` , e ) ;
432+ } catch ( e : any ) {
433+ const status = e ?. status || e ?. response ?. status ;
434+ const data = e ?. response ?. data ;
435+ log . error ( `리뷰 실패: ${ file . filename } (status=${ status } )` ) ;
436+ if ( data ) {
437+ try {
438+ log . error ( `GitHub API error payload: ${ JSON . stringify ( data , null , 2 ) } ` ) ;
439+ } catch { }
440+ }
441+ log . error ( "원시 오류:" , e ) ;
428442 }
429443 }
430444 }
@@ -450,7 +464,15 @@ export const robot = (app: Probot) => {
450464 commit_id : commits [ commits . length - 1 ] . sha ,
451465 comments : ress ,
452466 } ) ;
453- } catch ( e ) {
467+ } catch ( e : any ) {
468+ const status = e ?. status || e ?. response ?. status ;
469+ const data = e ?. response ?. data ;
470+ log . error ( `리뷰 생성 실패 (status=${ status } )` ) ;
471+ if ( data ) {
472+ try {
473+ log . error ( `GitHub API error payload: ${ JSON . stringify ( data , null , 2 ) } ` ) ;
474+ } catch { }
475+ }
454476 log . info ( `Failed to create review` , e ) ;
455477 }
456478
0 commit comments