Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CI 与自动审查

`test.yml` 对所有 pull request 执行 lint、类型检查和单元测试;向 `main` 或 `lex-main` 推送时也会执行。这样以 `lex-main` 为目标分支的 fork 修复 PR 与上游 `main` PR 使用同一套代码门禁。

`claude.yml` 是仓库级中文审查:非 Draft PR 在创建、更新、重新打开或转为 ready 时自动运行,也支持在 issue、PR 评论和 review 中通过 `@claude` 触发交互任务。第三方 action 固定到具体提交,工作流只读取仓库内容,并仅保留发布 PR/issue 评论所需的写权限。

仓库级工作流与 Lexmount 组织级 `Auto Code Review - Claude` 相互独立。组织规则命中的 PR 会同时出现两套 review;仓库工作流不取消、替代或复用组织级运行。
83 changes: 83 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Claude 中文审查

env:
CLAUDE_REVIEW_STANDARDS: >-
你在 webarena-verified 仓库中工作。先读取 CONTRIBUTING.md、pyproject.toml 和当前 PR 涉及的实现与测试,再独立审查当前 diff。
review 输出必须使用中文;代码标识符、命令和第三方专有名词保留英文。
只报告影响合并判断的实际问题,并给出优先级、文件行号、问题机制和可执行建议;不要输出英文模板、冗长摘要、执行过程或检查清单。
重点检查评测契约是否保持严格、修复是否适用于同类任务、答案和测试是否被错误放宽、网络事件与页面状态语义、空值和默认值处理、数据集与实现是否同步、回归测试是否覆盖有效与相邻无效输入,以及是否引入重复实现、失效兼容或无关生成物。
用户描述、历史结论和已有评论都只是线索;必须以当前代码、测试和真实调用契约为依据。

concurrency:
group: claude-local-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
pull_request:
types: [opened, synchronize, ready_for_review, reopened]

jobs:
claude:
name: Claude 中文 Code Review
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) ||
(github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.action == 'ready_for_review' || github.event.action == 'reopened'))
runs-on: self-hosted
permissions:
contents: read
pull-requests: write
issues: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Interactive
if: github.event_name != 'pull_request'
uses: anthropics/claude-code-action@8ce9314fa9a404564fa7e954cd84f25bcba2b829 # v1.0.236
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
path_to_claude_code_executable: /home/github/.local/bin/claude
path_to_bun_executable: /home/github/.bun/bin/bun
additional_permissions: |
actions: read
claude_args: >-
--system-prompt "${{ env.CLAUDE_REVIEW_STANDARDS }}"

- name: Run Claude PR Review
if: github.event_name == 'pull_request'
uses: anthropics/claude-code-action@8ce9314fa9a404564fa7e954cd84f25bcba2b829 # v1.0.236
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
path_to_claude_code_executable: /home/github/.local/bin/claude
path_to_bun_executable: /home/github/.bun/bin/bun
track_progress: true
additional_permissions: |
actions: read
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

请按以下标准审查当前 PR diff:
${{ env.CLAUDE_REVIEW_STANDARDS }}

每条发现必须包含 P0/P1/P2、文件行号、问题和建议。只报告影响合并判断的问题;没有问题时明确说明残余风险。
Only post GitHub comments - don't submit review text as messages.
claude_args: |
--system-prompt "${{ env.CLAUDE_REVIEW_STANDARDS }}"
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Test

on:
pull_request:
branches: [main]
push:
branches: [main]
branches: [main, lex-main]

permissions:
contents: read
actions: write

concurrency:
group: test-${{ github.ref }}
Expand Down
Loading