|
| 1 | +name: OpenCode Review |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: |
| 6 | + - opened |
| 7 | + - reopened |
| 8 | + - ready_for_review |
| 9 | + issue_comment: |
| 10 | + types: |
| 11 | + - created |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: opencode-review-${{ github.event.pull_request.number || github.event.issue.number }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +permissions: {} |
| 18 | + |
| 19 | +jobs: |
| 20 | + review: |
| 21 | + name: AI Code Review (opencode/big-pickle) |
| 22 | + # Auto-review when an owner / member / collaborator opens, reopens, or |
| 23 | + # marks a PR ready for review. Skip auto-review when the PR description |
| 24 | + # contains `/no-bot-review`. Manual re-review (including for outside |
| 25 | + # contributions) when an owner / member / collaborator comments |
| 26 | + # `/oc review` or `/opencode review`; the explicit trigger overrides the |
| 27 | + # skip marker. |
| 28 | + if: | |
| 29 | + ( |
| 30 | + github.event_name == 'pull_request' && |
| 31 | + ( |
| 32 | + github.event.pull_request.author_association == 'OWNER' || |
| 33 | + github.event.pull_request.author_association == 'MEMBER' || |
| 34 | + github.event.pull_request.author_association == 'COLLABORATOR' |
| 35 | + ) && |
| 36 | + !contains(github.event.pull_request.body, '/no-bot-review') |
| 37 | + ) || |
| 38 | + ( |
| 39 | + github.event_name == 'issue_comment' && |
| 40 | + github.event.issue.pull_request != null && |
| 41 | + ( |
| 42 | + contains(github.event.comment.body, ' /oc review') || |
| 43 | + startsWith(github.event.comment.body, '/oc review') || |
| 44 | + contains(github.event.comment.body, ' /opencode review') || |
| 45 | + startsWith(github.event.comment.body, '/opencode review') |
| 46 | + ) && |
| 47 | + ( |
| 48 | + github.event.comment.author_association == 'OWNER' || |
| 49 | + github.event.comment.author_association == 'MEMBER' || |
| 50 | + github.event.comment.author_association == 'COLLABORATOR' |
| 51 | + ) |
| 52 | + ) |
| 53 | + runs-on: ubuntu-latest |
| 54 | + permissions: |
| 55 | + contents: read |
| 56 | + issues: write |
| 57 | + pull-requests: write |
| 58 | + env: |
| 59 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
| 63 | + with: |
| 64 | + persist-credentials: false |
| 65 | + fetch-depth: 0 |
| 66 | + |
| 67 | + # Comment-triggered runs start on the default branch; switch to the PR |
| 68 | + # head so opencode reviews the PR's code. |
| 69 | + - if: github.event_name == 'issue_comment' |
| 70 | + run: gh pr checkout "${{ github.event.issue.number }}" --repo "$GITHUB_REPOSITORY" |
| 71 | + |
| 72 | + - name: Run opencode review |
| 73 | + uses: Barmore-Genc/opencode-pr-reviewer@d34c66bc5c72cb84b6b7c1572c2752b16fdfe339 # v1 |
| 74 | + with: |
| 75 | + model: opencode/big-pickle |
| 76 | + pr-number: ${{ github.event.pull_request.number || github.event.issue.number }} |
| 77 | + user-comment: ${{ github.event.comment.body }} |
0 commit comments