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:
   issue_comment:
     types: [created]
-  pull_request:
-    types: [opened, ready_for_review]
-
-env:
-  REVIEW_PROMPT: "Please review this PR for code quality, bugs, and best practices."
 
 jobs:
   opencode:
     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
     permissions:
+      id-token: write
+      contents: write
       pull-requests: write
       issues: write
-      id-token: write
     steps:
       - name: Checkout repository
         uses: actions/checkout@v4
@@ -30,28 +22,8 @@ jobs:
           fetch-depth: 1
 
       - name: Run opencode
-        uses: sst/opencode/github@v0.5.27
+        uses: sst/opencode/github@latest
         env:
           ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
         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.
 
 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