diff --git a/github/index.ts b/github/index.ts index 35abb03cb..341abeb1b 100644 --- a/github/index.ts +++ b/github/index.ts @@ -809,7 +809,7 @@ function buildPromptDataForPR(pr: GitHubPullRequest) { ] })(), ...(() => { - const reviews = pr.reviews.nodes ?? [] + const reviews = pr.reviews?.nodes ?? [] if (reviews.length === 0) return [] return [ "", diff --git a/github/src/types.ts b/github/src/types.ts index 65312a50e..145bc530e 100644 --- a/github/src/types.ts +++ b/github/src/types.ts @@ -74,7 +74,7 @@ export type GitHubPullRequest = { comments: { nodes: GitHubComment[] } - reviews: { + reviews?: { nodes: GitHubReview[] } reviewThreads: {