@@ -286,17 +286,38 @@ export class GitHubClient {
286286 }
287287
288288 async getPRComments ( owner : string , repo : string , prNumber : number ) : Promise < any [ ] > {
289- const url = `${ this . baseUrl } /repos/${ owner } /${ repo } /issues/${ prNumber } /comments` ;
290-
291- const response = await this . makeRequest ( url , {
292- method : 'GET' ,
293- } ) ;
289+ // Fetch both issue comments (general discussion) and review comments (inline code comments)
290+ const [ issueCommentsResponse , reviewCommentsResponse ] = await Promise . all ( [
291+ // General PR discussion comments
292+ this . makeRequest ( `${ this . baseUrl } /repos/${ owner } /${ repo } /issues/${ prNumber } /comments` , {
293+ method : 'GET' ,
294+ } ) ,
295+ // Inline code review comments
296+ this . makeRequest ( `${ this . baseUrl } /repos/${ owner } /${ repo } /pulls/${ prNumber } /comments` , {
297+ method : 'GET' ,
298+ } )
299+ ] ) ;
300+
301+ if ( ! issueCommentsResponse . ok ) {
302+ const errorText = await issueCommentsResponse . text ( ) ;
303+ throw new Error ( `GitHub API error (issue comments): ${ issueCommentsResponse . status } ${ issueCommentsResponse . statusText } - ${ errorText } ` ) ;
304+ }
294305
295- if ( ! response . ok ) {
296- const errorText = await response . text ( ) ;
297- throw new Error ( `GitHub API error: ${ response . status } ${ response . statusText } - ${ errorText } ` ) ;
306+ if ( ! reviewCommentsResponse . ok ) {
307+ const errorText = await reviewCommentsResponse . text ( ) ;
308+ throw new Error ( `GitHub API error (review comments) : ${ reviewCommentsResponse . status } ${ reviewCommentsResponse . statusText } - ${ errorText } ` ) ;
298309 }
299310
300- return await response . json ( ) ;
311+ const issueComments = await issueCommentsResponse . json ( ) ;
312+ const reviewComments = await reviewCommentsResponse . json ( ) ;
313+
314+ // Combine both types with a type indicator
315+ const allComments = [
316+ ...issueComments . map ( ( comment : any ) => ( { ...comment , comment_type : 'issue' } ) ) ,
317+ ...reviewComments . map ( ( comment : any ) => ( { ...comment , comment_type : 'review' } ) )
318+ ] ;
319+
320+ // Sort by creation date
321+ return allComments . sort ( ( a , b ) => new Date ( a . created_at ) . getTime ( ) - new Date ( b . created_at ) . getTime ( ) ) ;
301322 }
302323}
0 commit comments