Skip to content

Commit 6baee07

Browse files
authored
docs: Github Auto Pull Request Docs (#5974)
1 parent 291b659 commit 6baee07

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

packages/web/src/content/docs/github.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ OpenCode can be triggered by the following GitHub events:
109109
| `issue_comment` | Comment on an issue or PR | Mention `/opencode` or `/oc` in your comment. OpenCode reads the issue/PR context and can create branches, open PRs, or reply with explanations. |
110110
| `pull_request_review_comment` | Comment on specific code lines in a PR | Mention `/opencode` or `/oc` while reviewing code. OpenCode receives file path, line numbers, and diff context for precise responses. |
111111
| `schedule` | Cron-based schedule | Run OpenCode on a schedule using the `prompt` input. Useful for automated code reviews, reports, or maintenance tasks. OpenCode can create issues or PRs as needed. |
112+
| `pull_request` | PR opened or updated | Automatically trigger OpenCode when PRs are opened, synchronized, or reopened. Useful for automated reviews without needing to leave a comment. |
112113

113114
### Schedule Example
114115

@@ -150,6 +151,43 @@ For scheduled events, the `prompt` input is **required** since there's no commen
150151

151152
---
152153

154+
### Pull Request Example
155+
156+
Automatically review PRs when they are opened or updated:
157+
158+
```yaml title=".github/workflows/opencode-review.yml"
159+
name: opencode-review
160+
161+
on:
162+
pull_request:
163+
types: [opened, synchronize, reopened, ready_for_review]
164+
165+
jobs:
166+
review:
167+
runs-on: ubuntu-latest
168+
permissions:
169+
id-token: write
170+
contents: read
171+
pull-requests: read
172+
issues: read
173+
steps:
174+
- uses: actions/checkout@v4
175+
- uses: sst/opencode/github@latest
176+
env:
177+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
178+
with:
179+
model: anthropic/claude-sonnet-4-20250514
180+
prompt: |
181+
Review this pull request:
182+
- Check for code quality issues
183+
- Look for potential bugs
184+
- Suggest improvements
185+
```
186+
187+
For `pull_request` events, if no `prompt` is provided, OpenCode defaults to reviewing the pull request.
188+
189+
---
190+
153191
## Custom prompts
154192

155193
Override the default prompt to customize OpenCode's behavior for your workflow.

0 commit comments

Comments
 (0)