45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
name: PR Review
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, reopened, ready_for_review, synchronize]
|
|
workflow_dispatch:
|
|
inputs:
|
|
pull_number:
|
|
description: PR number
|
|
required: true
|
|
type: number
|
|
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
concurrency:
|
|
group: pr-review-${{ github.event.pull_request.number || inputs.pull_number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
review:
|
|
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 12
|
|
steps:
|
|
# For fork PRs, load the reviewer from the trusted workflow commit.
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
ref: ${{ github.workflow_sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Install OpenCode
|
|
run: npm install --prefix "$RUNNER_TEMP/pr-review-tools" --ignore-scripts --no-audit --no-fund opencode-linux-x64@1.19.6
|
|
|
|
- name: Review PR
|
|
env:
|
|
PR_REVIEW_OPENCODE: ${{ runner.temp }}/pr-review-tools/node_modules/opencode-linux-x64/bin/opencode
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
PR_REVIEW_LLM_KEY: ${{ secrets.PR_REVIEW_LLM_KEY }}
|
|
PR_REVIEW_LLM_BASE_URL: ${{ vars.PR_REVIEW_LLM_BASE_URL || 'https://open.bigmodel.cn/api/anthropic' }}
|
|
PR_REVIEW_LLM_MODEL: ${{ vars.PR_REVIEW_LLM_MODEL || 'glm-5.4' }}
|
|
run: node .github/scripts/pr-review.mjs
|