Skip to content

Preserve snapshots until retention expiry #120

Preserve snapshots until retention expiry

Preserve snapshots until retention expiry #120

Workflow file for this run

# Actions secrets: MINIMAX_API_KEY, FEISHU_WEBHOOK_URL; optional FEISHU_WEBHOOK_SECRET.

Check warning on line 1 in .github/workflows/ci-review.yml

View workflow run for this annotation

GitHub Actions / CI review and Feishu notification

Workflow execution policy warning (evaluate mode)

On November 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
# Review the merged source and existing PR checks without running CI again.
name: CI review and Feishu notification
on:
pull_request_target:
branches: [main]
types: [closed]
permissions:
contents: read
actions: read
checks: read
statuses: read
pull-requests: read
jobs:
review:
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- kind: code
name: Code review
instructions: |
检查本次代码改动的正确性、仓库设计规则及已有 CI 结果。先读取 AGENTS.md 和 CONTRIBUTING.md,再查看相关实现和测试。
用 gh pr checks 查询这个 PR 已有的检查结果,必要时读取 Actions 日志。检查失败、缺失或尚未完成时如实报告,不把合并当作检查通过的证据。
报告包括实际行为变化(1–3 条)、代码审查结论和 CI 状态。全部正常时保持简短;有问题时给出文件与行号、证据和最小修改建议。
- kind: docs
name: Docs review
instructions: |
每次都检查文档与本次代码变化是否一致,即使 PR 没改文档。读取相关实现、测试和完整文档,核对平台、命令、配置、路径、默认值、接口和操作流程,找出遗漏更新或已经过时的说明。
文档有修改(包括新增、删除和重命名)时,再检查文档内部及同主题文档间的矛盾、重复维护的事实、主题归属和中英文含义。按 AGENTS.md 和 CONTRIBUTING.md 的 Documentation ownership 表判断位置。必要的概述加链接、中英文对照和同一来源生成的文档不算重复。
分别报告“文档与代码一致性”和“文档矛盾、重复与归属”。未改文档时,第二项写“本次未修改文档”。只报告本次修改引入或使之过时的、有依据的问题,给出文件与行号、对应代码或文档依据,以及最小修改建议。测试或链接检查通过不代表语义一致。只报告影响读者理解或操作的具体问题,不把未穷举实现细节当作文档缺陷。
if: github.event.pull_request.merged == true
runs-on: ${{ vars.OAC_USE_GITHUB_RUNNERS == 'true' && 'ubuntu-24.04' || 'blacksmith-2vcpu-ubuntu-2404' }}
timeout-minutes: 30
env:
# Keep GH_TOKEN available to read the PR and Actions logs.
CLAUDE_CODE_SUBPROCESS_ENV_SCRUB: '0'
steps:
# The triggering revision is already on main, so its rules and code are trusted.
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 2
persist-credentials: false
- name: Prepare the report schema
id: schema
run: python3 scripts/ci_review.py schema "${{ matrix.kind }}" >> "$GITHUB_OUTPUT"
- name: Review with Claude Code
id: llm
continue-on-error: true
timeout-minutes: 25
uses: anthropics/claude-code-action@12dd8d74c712f5f3669365b2369b558c495b1104 # v1
env:
ANTHROPIC_BASE_URL: https://api.minimax.cn/anthropic
ANTHROPIC_AUTH_TOKEN: ${{ secrets.MINIMAX_API_KEY }}
CLAUDE_CODE_AUTO_COMPACT_WINDOW: '524288'
ANTHROPIC_MODEL: MiniMax-M3.1-Flash-Preview[1m]
ANTHROPIC_DEFAULT_SONNET_MODEL: MiniMax-M3.1-Flash-Preview[1m]
ANTHROPIC_DEFAULT_OPUS_MODEL: MiniMax-M3.1-Flash-Preview[1m]
ANTHROPIC_DEFAULT_HAIKU_MODEL: MiniMax-M3.1-Flash-Preview[1m]
with:
anthropic_api_key: ${{ secrets.MINIMAX_API_KEY }}
# The action also exports this token as GH_TOKEN, so gh works inside Claude.
github_token: ${{ github.token }}
display_report: true
show_full_output: true
allowed_bots: '*'
allowed_non_write_users: '*'
prompt: |
你负责本次 PR 的 ${{ matrix.name }},在独立上下文中完成审查。
仓库:${{ github.repository }};PR:#${{ github.event.pull_request.number }}。
合并提交:${{ github.event.pull_request.merge_commit_sha }},已检出到当前目录。
先用 gh pr diff ${{ github.event.pull_request.number }} --repo ${{ github.repository }} 读取变更清单与完整差异,再检查相关文件。
${{ matrix.instructions }}
按 JSON schema 返回中文报告。status 为 ok(未发现问题)、issues(发现有证据的问题)或 incomplete(审查失败、范围未检查完整或检查结果尚未完成)。有问题且仍有未检查项时,用 issues 并在对应字段中说明缺项。按 schema 把各项结论分别填入字段,不要重复标题;changes 用 1–3 条 Markdown 列表,其他字段无问题时一句话,有问题时保留依据和建议,遵守各字段长度限制。
围绕本次 diff 和受影响的文档展开,证据充分后输出结果,避免重复核对同一结论。
只读审查,不修改仓库,不触发新的 CI,不发送消息。两份报告会由后续 job 合并发送。
claude_args: >-
--allowedTools Bash Read Glob Grep
--json-schema '${{ steps.schema.outputs.schema }}'
- name: Save the review result
if: always()
env:
REVIEW_OUTCOME: ${{ steps.llm.outcome }}
REVIEW_RESULT: ${{ steps.llm.outputs.structured_output }}
run: python3 scripts/ci_review.py collect "${{ matrix.kind }}" "$RUNNER_TEMP/review-${{ matrix.kind }}.json"
- uses: actions/upload-artifact@v6
if: always()
with:
name: ci-review-${{ matrix.kind }}
path: ${{ runner.temp }}/review-${{ matrix.kind }}.json
if-no-files-found: error
overwrite: true
retention-days: 7
notify:
name: Combined Feishu notification
needs: review
if: always() && github.event.pull_request.merged == true
runs-on: ${{ vars.OAC_USE_GITHUB_RUNNERS == 'true' && 'ubuntu-24.04' || 'blacksmith-2vcpu-ubuntu-2404' }}
timeout-minutes: 5
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
persist-credentials: false
- uses: actions/download-artifact@v6
continue-on-error: true
with:
pattern: ci-review-*
merge-multiple: true
path: ${{ runner.temp }}/reviews
- name: Send one card with both results
continue-on-error: true
env:
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}
FEISHU_WEBHOOK_SECRET: ${{ secrets.FEISHU_WEBHOOK_SECRET }}
run: python3 scripts/ci_review.py notify "$RUNNER_TEMP/reviews"