* ci: raise PR review token budgets Most medium and large reviews stopped on the token budget before covering the whole diff. Raise the budgets and time limits, keep partial results when some review tasks fail, and log actual token usage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: report why OCR review items failed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
90 lines
3.4 KiB
YAML
90 lines
3.4 KiB
YAML
name: PR Review
|
|
|
|
on:
|
|
pull_request_target:
|
|
branches: [main]
|
|
types: [opened, reopened, ready_for_review, synchronize]
|
|
workflow_dispatch:
|
|
inputs:
|
|
pull_number:
|
|
description: PR number
|
|
required: true
|
|
type: number
|
|
|
|
permissions: {}
|
|
|
|
env:
|
|
OCR_VERSION: v1.14.8
|
|
OCR_SHA256: fd82b5ddc1599fbad0680231a74e5292d4d7158522642e06c9229ed6ef32365f
|
|
|
|
concurrency:
|
|
group: pr-review-${{ github.event.pull_request.number || inputs.pull_number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
review:
|
|
name: Reims Go Reviewer
|
|
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'workflow_dispatch' || !github.event.pull_request.draft)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Create reviewer App token
|
|
id: app-token
|
|
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
|
|
with:
|
|
app-id: ${{ secrets.OCR_APP_ID }}
|
|
private-key: ${{ secrets.OCR_APP_PRIVATE_KEY }}
|
|
repositories: Reims-Go
|
|
|
|
# Load only trusted scripts, rules, and documentation from the workflow commit.
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
ref: ${{ github.workflow_sha }}
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
sparse-checkout-cone-mode: false
|
|
sparse-checkout: |
|
|
/.github/scripts/pr-review.mjs
|
|
/.github/scripts/pr-review-language.mjs
|
|
/.opencodereview/rule.json
|
|
/docs/pr-review-guidelines.md
|
|
/docs/design-guidelines.md
|
|
/go.mod
|
|
|
|
- name: Cache OpenCodeReview binary
|
|
id: ocr-cache
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: ${{ runner.temp }}/ocr-bin
|
|
key: opencodereview-${{ env.OCR_VERSION }}-${{ env.OCR_SHA256 }}
|
|
|
|
- name: Download OpenCodeReview
|
|
if: steps.ocr-cache.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p "$RUNNER_TEMP/ocr-bin"
|
|
curl --fail --location --retry 3 --output "$RUNNER_TEMP/ocr-bin/ocr" "https://github.com/alibaba/open-code-review/releases/download/$OCR_VERSION/opencodereview-linux-amd64"
|
|
|
|
- name: Verify OpenCodeReview
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
echo "$OCR_SHA256 $RUNNER_TEMP/ocr-bin/ocr" | sha256sum --check --strict
|
|
chmod 700 "$RUNNER_TEMP/ocr-bin/ocr"
|
|
|
|
- name: Review PR
|
|
env:
|
|
PR_REVIEW_OCR_BIN: ${{ runner.temp }}/ocr-bin/ocr
|
|
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
PR_REVIEW_BOT_LOGIN: ${{ vars.PR_REVIEW_BOT_LOGIN }}
|
|
PR_REVIEW_APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
|
|
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' }}
|
|
PR_REVIEW_LLM_PROTOCOL: ${{ vars.PR_REVIEW_LLM_PROTOCOL || 'anthropic' }}
|
|
PR_REVIEW_LLM_EXTRA_BODY: ${{ vars.PR_REVIEW_LLM_EXTRA_BODY }}
|
|
PR_REVIEW_CODE_SUGGESTIONS: ${{ vars.PR_REVIEW_CODE_SUGGESTIONS }}
|
|
run: node .github/scripts/pr-review.mjs
|