summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-11-26 00:14:04 -0600
committerAiden Cline <[email protected]>2025-11-26 00:14:04 -0600
commit14e823e93878a4bc900696a43a9a90b70e81621f (patch)
tree63b06eb461d591b5e287ce797de093ea29f3033f /packages
parent2fbd462e6e35263274e975a2084324b8721f886f (diff)
downloadopencode-14e823e93878a4bc900696a43a9a90b70e81621f.tar.gz
opencode-14e823e93878a4bc900696a43a9a90b70e81621f.zip
ignore: fix type issue
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/cli/cmd/github.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts
index 5f9bcded1..b255e17d1 100644
--- a/packages/opencode/src/cli/cmd/github.ts
+++ b/packages/opencode/src/cli/cmd/github.ts
@@ -390,6 +390,7 @@ export const GithubRunCommand = cmd({
const share = normalizeShare()
const { owner, repo } = context.repo
const payload = context.payload as IssueCommentEvent | PullRequestReviewCommentEvent
+ const issueEvent = isIssueCommentEvent(payload) ? payload : undefined
const actor = context.actor
const issueId =
@@ -440,7 +441,7 @@ export const GithubRunCommand = cmd({
// 1. Issue
// 2. Local PR
// 3. Fork PR
- if (payload.issue.pull_request) {
+ if (context.eventName === "pull_request_review_comment" || issueEvent?.issue.pull_request) {
const prData = await fetchPR()
// Local PR
if (prData.headRepository.nameWithOwner === prData.baseRepository.nameWithOwner) {
@@ -537,6 +538,12 @@ export const GithubRunCommand = cmd({
throw new Error(`Invalid share value: ${value}. Share must be a boolean.`)
}
+ function isIssueCommentEvent(
+ event: IssueCommentEvent | PullRequestReviewCommentEvent,
+ ): event is IssueCommentEvent {
+ return "issue" in event
+ }
+
function getReviewCommentContext() {
if (context.eventName !== "pull_request_review_comment") {
return null
@@ -686,7 +693,10 @@ export const GithubRunCommand = cmd({
try {
return await chat(`Summarize the following in less than 40 characters:\n\n${response}`)
} catch (e) {
- return `Fix issue: ${payload.issue.title}`
+ const title = issueEvent
+ ? issueEvent.issue.title
+ : (payload as PullRequestReviewCommentEvent).pull_request.title
+ return `Fix issue: ${title}`
}
}