@@ -12,14 +12,26 @@ import type { components } from "@octokit/openapi-types";
1212import { useAuth } from "./auth" ;
1313
1414// Re-export types
15- export type PullRequest = components [ "schemas" ] [ "pull-request" ] ;
15+ // Extended PullRequest with body_html from GitHub's HTML media type
16+ export type PullRequest = components [ "schemas" ] [ "pull-request" ] & {
17+ body_html ?: string ;
18+ } ;
1619export type PullRequestFile = components [ "schemas" ] [ "diff-entry" ] ;
20+ // Extended ReviewComment with body_html from GitHub's HTML media type
1721export type ReviewComment =
18- components [ "schemas" ] [ "pull-request-review-comment" ] ;
19- export type Review = components [ "schemas" ] [ "pull-request-review" ] ;
22+ components [ "schemas" ] [ "pull-request-review-comment" ] & {
23+ body_html ?: string ;
24+ } ;
25+ // Extended Review with body_html from GitHub's HTML media type
26+ export type Review = components [ "schemas" ] [ "pull-request-review" ] & {
27+ body_html ?: string ;
28+ } ;
2029export type CheckRun = components [ "schemas" ] [ "check-run" ] ;
2130export type CombinedStatus = components [ "schemas" ] [ "combined-commit-status" ] ;
22- export type IssueComment = components [ "schemas" ] [ "issue-comment" ] ;
31+ // Extended IssueComment with body_html from GitHub's HTML media type
32+ export type IssueComment = components [ "schemas" ] [ "issue-comment" ] & {
33+ body_html ?: string ;
34+ } ;
2335export type PRCommit = components [ "schemas" ] [ "commit" ] ;
2436export type Collaborator = components [ "schemas" ] [ "collaborator" ] ;
2537export type Reaction = components [ "schemas" ] [ "reaction" ] ;
@@ -118,6 +130,8 @@ export interface ReviewThread {
118130 id : string ;
119131 databaseId : number ;
120132 body : string ;
133+ /** Pre-rendered HTML with signed attachment URLs from GitHub's GraphQL API */
134+ bodyHTML ?: string ;
121135 path : string ;
122136 line : number | null ;
123137 originalLine : number | null ;
@@ -1009,10 +1023,14 @@ function createGitHubStore() {
10091023 owner,
10101024 repo,
10111025 pull_number : number ,
1026+ headers : {
1027+ // Request full media type to get both body and body_html with signed attachment URLs
1028+ accept : "application/vnd.github.full+json" ,
1029+ } ,
10121030 } )
10131031 . then ( ( res ) => {
1014- cache . set ( cacheKey , res . data ) ;
1015- return res . data ;
1032+ cache . set ( cacheKey , res . data as PullRequest ) ;
1033+ return res . data as PullRequest ;
10161034 } ) ;
10171035
10181036 cache . setPending ( cacheKey , promise ) ;
@@ -1090,9 +1108,13 @@ function createGitHubStore() {
10901108 pull_number : number ,
10911109 per_page : 100 ,
10921110 page,
1111+ headers : {
1112+ // Request full media type to get both body and body_html with signed attachment URLs
1113+ accept : "application/vnd.github.full+json" ,
1114+ } ,
10931115 }
10941116 ) ;
1095- comments . push ( ...data ) ;
1117+ comments . push ( ...( data as ReviewComment [ ] ) ) ;
10961118 if ( data . length < 100 ) break ;
10971119 page ++ ;
10981120 }
@@ -1175,10 +1197,14 @@ function createGitHubStore() {
11751197 owner,
11761198 repo,
11771199 pull_number : number ,
1200+ headers : {
1201+ // Request full media type to get both body and body_html with signed attachment URLs
1202+ accept : "application/vnd.github.full+json" ,
1203+ } ,
11781204 } )
11791205 . then ( ( res ) => {
1180- cache . set ( cacheKey , res . data ) ;
1181- return res . data ;
1206+ cache . set ( cacheKey , res . data as Review [ ] ) ;
1207+ return res . data as Review [ ] ;
11821208 } ) ;
11831209
11841210 cache . setPending ( cacheKey , promise ) ;
@@ -2001,10 +2027,14 @@ function createGitHubStore() {
20012027 owner,
20022028 repo,
20032029 issue_number : number ,
2030+ headers : {
2031+ // Request full media type to get both body and body_html with signed attachment URLs
2032+ accept : "application/vnd.github.full+json" ,
2033+ } ,
20042034 } )
20052035 . then ( ( res ) => {
2006- cache . set ( cacheKey , res . data ) ;
2007- return res . data ;
2036+ cache . set ( cacheKey , res . data as IssueComment [ ] ) ;
2037+ return res . data as IssueComment [ ] ;
20082038 } ) ;
20092039
20102040 cache . setPending ( cacheKey , promise ) ;
@@ -2321,6 +2351,7 @@ function createGitHubStore() {
23212351 id : string ;
23222352 databaseId : number ;
23232353 body : string ;
2354+ bodyHTML : string ;
23242355 path : string ;
23252356 line : number | null ;
23262357 originalLine : number | null ;
@@ -2363,6 +2394,7 @@ function createGitHubStore() {
23632394 id
23642395 databaseId
23652396 body
2397+ bodyHTML
23662398 path
23672399 line
23682400 originalLine
0 commit comments