Skip to content

fix(opencode): support pull_request_review as a trigger event - #50277

Open
argszero wants to merge 1 commit into
anomalyco:devfrom
argszero:review-body-trigger
Open

argszero wants to merge 1 commit into
anomalyco:devfrom
argszero:review-body-trigger

Conversation

@argszero

Copy link
Copy Markdown

Issue for this PR

Closes #50247

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

pull_request_review was described as a supported event, but it was not actually handled. It was missing from USER_EVENTS, so it fell through to the generic "Review this pull request" prompt, and the instruction was read from payload.comment.body — a field a review payload does not have. A review whose body says /oc therefore did nothing.

This adds pull_request_review (types: [submitted]) to the event routing, to the generated workflow's on:/if: blocks, and reads the instruction from review.body for review events.

Review bodies can be null when a review is submitted without text, so the new resolveTriggerBody helper keeps two cases apart: undefined means the event has no body source at all (malformed payload worth failing on), while "" means an empty body, which is reported as a missing mention. The helper is a pure function next to extractResponseText, exported through github.ts like the other shared helpers.

github/README.md and the docs event table are updated to match the workflow opencode github install now generates.

How did you verify your code works?

  • bun test test/cli/github-action.test.ts → 23 pass / 0 fail, including 6 new resolveTriggerBody cases (comment body for comment events, review body for reviews, a review never reading comment.body, a comment never reading review.body, body: null"", no body source → undefined)
  • The rest of the CLI test suite passes locally and tsgo --noEmit is clean
  • Cross-checked the payload shapes against @octokit/webhooks-types: every PullRequestReviewEvent variant types review.body as string | null, and SimplePullRequest carries number, so the PR-context path resolves correctly

Screenshots / recordings

N/A — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub action: pull_request_review (review body) is not a supported trigger event

1 participant