PR agent
This commit is contained in:
parent
2339935930
commit
a26bbe5e41
2 changed files with 8 additions and 34 deletions
38
.github/workflows/opencode.yml
vendored
38
.github/workflows/opencode.yml
vendored
|
|
@ -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') ||
|
||||||
contains(github.event.comment.body, '/oc ') ||
|
contains(github.event.comment.body, '/opencode')
|
||||||
startsWith(github.event.comment.body, '/oc') ||
|
|
||||||
contains(github.event.comment.body, '/opencode ') ||
|
|
||||||
startsWith(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
|
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}`
|
|
||||||
});
|
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in a new issue