Skip to content

opencode-review

opencode-review #4

name: opencode-review
on:
# issue_comment covers both issues and PR comments
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
review:
# Only trigger in PRs (not issues), and require @opencode or /opencode trigger
if: |
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
(
contains(github.event.comment.body, '@opencode') ||
contains(github.event.comment.body, '/opencode')
)
) ||
(
github.event_name == 'pull_request_review_comment' &&
(
contains(github.event.comment.body, '@opencode') ||
contains(github.event.comment.body, '/opencode')
)
)
runs-on: ubuntu-latest
permissions:
contents: read # Change to 'write' to allow OpenCode to push commits
pull-requests: write # Required to post comments (kept as write for responses)
issues: read # Change to 'write' if you enable issue workflows later
actions: read # Required to read CI results on PRs
id-token: write # Required for OIDC token generation (OpenCode GitHub App)
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: anomalyco/opencode/github@latest
env:
# ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
ZHIPU_BASE_URL: ${{ secrets.ZHIPU_BASE_URL }}
# with:
# # model: anthropic/claude-sonnet-4-20250514
# model: zai-coding-plan/glm-4.7
# use_github_token: true
# prompt: |
# Review this pull request:
# - Check for code quality issues
# - Look for potential bugs
# - Suggest improvements
with:
model: ${{ secrets.OPENCODE_PR_REVIEW_MODEL }}
share: false
prompt: |
Review this pull request with focus on:
- Code quality and best practices
- Security vulnerabilities
- Performance implications
- Breaking changes
- Test coverage
- Documentation updates needed
Please provide specific, actionable feedback.
Do not attempt to push changes, only suggest them in the review.
Additionally, update the PR description if needed:
- Summarize key changes
- Do not suggest description changes in a comment, update the description directly.
- If there is a description already, improve it rather than replacing it entirely.
Do not:
- Duplicate information in the PR description and comments.
- Make assumptions about the code outside of the diff.
- Add multiple comments on the same PR