|
@@ -3,26 +3,18 @@ name: opencode
|
|
|
on:
|
|
on:
|
|
|
issue_comment:
|
|
issue_comment:
|
|
|
types: [created]
|
|
types: [created]
|
|
|
- pull_request:
|
|
|
|
|
- types: [opened, ready_for_review]
|
|
|
|
|
-
|
|
|
|
|
-env:
|
|
|
|
|
- REVIEW_PROMPT: "Please review this PR for code quality, bugs, and best practices."
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
jobs:
|
|
|
opencode:
|
|
opencode:
|
|
|
if: |
|
|
if: |
|
|
|
- github.event_name == 'issue_comment' && (
|
|
|
|
|
- contains(github.event.comment.body, '/oc ') ||
|
|
|
|
|
- startsWith(github.event.comment.body, '/oc') ||
|
|
|
|
|
- contains(github.event.comment.body, '/opencode ') ||
|
|
|
|
|
- startsWith(github.event.comment.body, '/opencode')
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ contains(github.event.comment.body, '/oc') ||
|
|
|
|
|
+ contains(github.event.comment.body, '/opencode')
|
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
|
permissions:
|
|
permissions:
|
|
|
|
|
+ id-token: write
|
|
|
|
|
+ contents: write
|
|
|
pull-requests: write
|
|
pull-requests: write
|
|
|
issues: write
|
|
issues: write
|
|
|
- id-token: write
|
|
|
|
|
steps:
|
|
steps:
|
|
|
- name: Checkout repository
|
|
- name: Checkout repository
|
|
|
uses: actions/checkout@v4
|
|
uses: actions/checkout@v4
|
|
@@ -30,28 +22,8 @@ jobs:
|
|
|
fetch-depth: 1
|
|
fetch-depth: 1
|
|
|
|
|
|
|
|
- name: Run opencode
|
|
- name: Run opencode
|
|
|
- uses: sst/opencode/github@v0.5.27
|
|
|
|
|
|
|
+ uses: sst/opencode/github@latest
|
|
|
env:
|
|
env:
|
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
|
with:
|
|
with:
|
|
|
- model: claude-3-5-sonnet-20241022
|
|
|
|
|
-
|
|
|
|
|
- auto-review:
|
|
|
|
|
- if: |
|
|
|
|
|
- github.event_name == 'pull_request' &&
|
|
|
|
|
- (github.event.action == 'opened' || github.event.action == 'ready_for_review') &&
|
|
|
|
|
- !github.event.pull_request.draft
|
|
|
|
|
- runs-on: ubuntu-latest
|
|
|
|
|
- permissions:
|
|
|
|
|
- pull-requests: write
|
|
|
|
|
- steps:
|
|
|
|
|
- - name: Request review
|
|
|
|
|
- uses: actions/github-script@v7
|
|
|
|
|
- with:
|
|
|
|
|
- script: |
|
|
|
|
|
- await github.rest.issues.createComment({
|
|
|
|
|
- owner: context.repo.owner,
|
|
|
|
|
- repo: context.repo.repo,
|
|
|
|
|
- issue_number: context.payload.pull_request.number,
|
|
|
|
|
- body: `/oc ${process.env.REVIEW_PROMPT}`
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ model: claude-3-5-sonnet-20241022
|