summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Polito <[email protected]>2025-12-23 12:39:14 -0300
committerGitHub <[email protected]>2025-12-23 09:39:14 -0600
commitab2a6c45a393621281d88c0c0da357d300361b74 (patch)
tree702d3dd2ef2c95bd6c7b0447c98e94918a716073
parent66563fb9741b6b7d6e4456c58b431d2231a1810a (diff)
downloadopencode-ab2a6c45a393621281d88c0c0da357d300361b74.tar.gz
opencode-ab2a6c45a393621281d88c0c0da357d300361b74.zip
Fix Github Pull Request Event (#6037)
-rw-r--r--packages/opencode/src/cli/cmd/github.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts
index 607fc7caf..6bfc53184 100644
--- a/packages/opencode/src/cli/cmd/github.ts
+++ b/packages/opencode/src/cli/cmd/github.ts
@@ -7,7 +7,7 @@ import { graphql } from "@octokit/graphql"
import * as core from "@actions/core"
import * as github from "@actions/github"
import type { Context } from "@actions/github/lib/context"
-import type { IssueCommentEvent, PullRequestReviewCommentEvent, PullRequestEvent } from "@octokit/webhooks-types"
+import type { IssueCommentEvent, PullRequestReviewCommentEvent, WorkflowRunEvent, PullRequestEvent } from "@octokit/webhooks-types"
import { UI } from "../ui"
import { cmd } from "./cmd"
import { ModelsDev } from "../../provider/models"
@@ -401,10 +401,8 @@ export const GithubRunCommand = cmd({
const oidcBaseUrl = normalizeOidcBaseUrl()
const { owner, repo } = context.repo
// For schedule events, payload has no issue/comment data
- const payload = isCommentEvent
- ? (context.payload as IssueCommentEvent | PullRequestReviewCommentEvent)
- : undefined
- const issueEvent = payload && isIssueCommentEvent(payload) ? payload : undefined
+ const payload = (context.payload as IssueCommentEvent | PullRequestReviewCommentEvent | WorkflowRunEvent | PullRequestEvent)
+ const issueEvent = isIssueCommentEvent(payload) ? payload : undefined
const actor = isScheduleEvent ? undefined : context.actor
const issueId = isScheduleEvent
@@ -423,7 +421,9 @@ export const GithubRunCommand = cmd({
let shareId: string | undefined
let exitCode = 0
type PromptFiles = Awaited<ReturnType<typeof getUserPrompt>>["promptFiles"]
- const triggerCommentId = payload?.comment.id
+ const triggerCommentId = isCommentEvent
+ ? (payload as IssueCommentEvent | PullRequestReviewCommentEvent).comment.id
+ : undefined
const useGithubToken = normalizeUseGithubToken()
const commentType = isCommentEvent
? context.eventName === "pull_request_review_comment"
@@ -619,7 +619,7 @@ export const GithubRunCommand = cmd({
}
function isIssueCommentEvent(
- event: IssueCommentEvent | PullRequestReviewCommentEvent,
+ event: IssueCommentEvent | PullRequestReviewCommentEvent | WorkflowRunEvent | PullRequestEvent,
): event is IssueCommentEvent {
return "issue" in event
}
@@ -664,7 +664,7 @@ export const GithubRunCommand = cmd({
if (!isCommentEvent) {
return "Review this pull request"
}
- const body = payload!.comment.body.trim()
+ const body = (payload as IssueCommentEvent | PullRequestReviewCommentEvent).comment.body.trim()
const bodyLower = body.toLowerCase()
if (mentions.some((m) => bodyLower === m)) {
if (reviewContext) {