Skip to content

Commit 127de32

Browse files
committed
fix(github): reply in the triggering review thread
1 parent 453b61e commit 127de32

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

packages/opencode/src/cli/cmd/github.handler.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,23 @@ export const githubRun = Effect.fn("Cli.github.run")(function* (args: { event?:
12631263

12641264
async function createComment(body: string) {
12651265
// Only called for non-schedule events, so issueId is defined
1266+
if (commentType === "pr_review") {
1267+
const comment = (payload as PullRequestReviewCommentEvent).comment
1268+
console.log("Creating review thread reply...")
1269+
try {
1270+
return await octoRest.rest.pulls.createReplyForReviewComment({
1271+
owner,
1272+
repo,
1273+
pull_number: issueId!,
1274+
// Replies must target the thread's root comment; a reply's own id is rejected
1275+
comment_id: comment.in_reply_to_id ?? comment.id,
1276+
body,
1277+
})
1278+
} catch (error) {
1279+
// Fall through to a top-level comment so the response is never lost
1280+
console.error(`Failed to reply in the review thread: ${error}`)
1281+
}
1282+
}
12661283
console.log("Creating comment...")
12671284
return await octoRest.rest.issues.createComment({
12681285
owner,

0 commit comments

Comments
 (0)