feat: add opencode PR auto review bot - #32
Merged
Elaina-Official merged 2 commits intoSep 1, 2026
Merged
Conversation
按 Contribution.md 自动审查 PR,用中文给出分级意见。 工作方式 - 本仓库分支发起的 PR:自动审查 - Fork 发起的 PR:GitHub 不会向其传递密钥,故自动跳过(不会留下失败的红叉), 由维护者在 PR 中评论 /oc 或 /opencode 触发;该事件在本仓库上下文中运行,因此对 Fork 同样有效 - 注:opencode 不支持 pull_request_target,无法借此让 Fork PR 自动审查 审查范围 agent 会完整读取 Contribution.md 并可浏览仓库中其他课程目录作横向对比, 而不仅限于本次 diff;重点覆盖目录与命名规范、README 四段模板与署名、 系统垃圾文件与编译中间产物、文件体积,以及同一文件内前后矛盾的信息。 稳定性与噪音控制 - 调用前先探测 provider,密钥缺失/失效、余额不足、模型不存在等情况直接跳过, 不会把报错发到同学的 PR 上;失败信息仅保留在 Actions 日志中 - 万一中途失败并已发出报错评论,兜底步骤会将其删除 (以评论 ID 基线 + 内容匹配双重限定,不会误删正常的审查意见) - share: false,评论末尾不再附带分享卡片 - 权限收敛为 contents:read / pull-requests:write,工作流不执行 PR 中的任何脚本 其他 - 仓库约 1.9GB 且 74% 为 PDF,checkout 使用 blob:none + 稀疏检出跳过二进制资料, 实测检出耗时约 1 秒 - update.py: 将 .github 加入 EXCLUDE_DIRS,此前它被当作课程组发布为 docs/.github/workflows.md 已在 Fork 上实测通过(#3)。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVz1wR41tLhZz9aF5qFSY5
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 引入基于 opencode 的 PR 自动审查机器人,通过 GitHub Actions 在 PR 打开/更新时(以及维护者评论触发时)自动生成中文审查意见;同时修复 update.py 误把 .github 当作课程目录处理的问题,并新增 opencode 的 provider 配置文件。
Changes:
- 新增 GitHub Actions 工作流:支持本仓库分支 PR 自动审查、Fork PR 通过
/oc或/opencode评论触发审查,并带有 provider preflight 与失败评论清理逻辑 - 新增
opencode.json:配置 Zhipu BigModel(GLM)provider 与模型映射 - 更新
update.py:将.github加入排除目录,避免生成docs/.github/...等错误输出
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
update.py |
将 .github 加入遍历排除目录,避免被当作课程组目录处理 |
opencode.json |
新增 opencode provider 配置(Zhipu/GLM) |
.github/workflows/opencode-review.yml |
新增 PR 自动审查工作流(含 preflight、触发条件与失败清理) |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Elaina-Official
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
按 Contribution.md 自动审查 PR,用中文给出分级意见。
工作方式
审查范围
agent 会完整读取 Contribution.md 并可浏览仓库中其他课程目录作横向对比,
而不仅限于本次 diff;重点覆盖目录与命名规范、README 四段模板与署名、
系统垃圾文件与编译中间产物、文件体积,以及同一文件内前后矛盾的信息。
稳定性与噪音控制
其他
已在 Fork 上实测通过(Snowflake-Pink#3)。