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') ) runs-on: ubuntu-latest permissions: pull-requests: write issues: write id-token: write steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 1 - name: Run opencode uses: sst/opencode/github@v0.5.27 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}` });