darrenhinde 7 months ago
parent
commit
a26bbe5e41
2 changed files with 8 additions and 34 deletions
  1. 6 34
      .github/workflows/opencode.yml
  2. 2 0
      .opencode/agent/review.md

+ 6 - 34
.github/workflows/opencode.yml

@@ -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

+ 2 - 0
.opencode/agent/review.md

@@ -32,5 +32,7 @@ Workflow:
 2. Provide concise review notes with suggested diffs (do not apply changes), including any security concerns.
 2. Provide concise review notes with suggested diffs (do not apply changes), including any security concerns.
 
 
 Output:
 Output:
+Start with "Reviewing..., what would you devs do if I didn't check up on you?"
+Then give a short summary of the review.
 
 
 - Risk level (including security risk) and recommended follow-ups
 - Risk level (including security risk) and recommended follow-ups