Skip to content

feat: dogfood review action in repo workflow#11

Merged
Svtter merged 2 commits into
mainfrom
feat/dogfood-review-action
Apr 14, 2026
Merged

feat: dogfood review action in repo workflow#11
Svtter merged 2 commits into
mainfrom
feat/dogfood-review-action

Conversation

@Svtter
Copy link
Copy Markdown
Collaborator

@Svtter Svtter commented Apr 14, 2026

Summary

  • add a repository pull_request workflow that uses the published Svtter/opencode-actions/review@v1 action to review this repo's own PRs
  • keep the workflow aligned with the public example by checking out the PR head and skipping forked pull requests where secrets are unavailable
  • add a regression test for the dogfood workflow and sync the review action prompt metadata with github-run-opencode

Verification

  • bash tests/test.sh

@sun-praise sun-praise deleted a comment from github-actions Bot Apr 14, 2026
@github-actions
Copy link
Copy Markdown

ProviderModelNotFoundError

opencode session  |  github run

@github-actions
Copy link
Copy Markdown

代码审查结果

总体评价

有条件合并

详细分析

优点

  1. Workflow 设计合理 - .github/workflows/review.yml 的条件判断正确:

    • github.event.pull_request.draft == false 跳过草稿 PR
    • github.event.pull_request.head.repo.full_name == github.repository 跳过 fork PR(安全考虑,避免 secrets 泄露)
  2. 安全意识良好 - 仅申请必要的 permissions(contents: read, pull-requests: write, issues: write

  3. 测试覆盖完整 - tests/dogfood-review-workflow.sh 对 workflow 的关键配置进行了验证

需要关注的问题

1. 潜在 bug:API Key 引用不一致

workflow 中同时传入了 zhipu-api-keyopencode-go-api-key

zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}

tests/dogfood-review-workflow.sh 只验证了 ZHIPU_API_KEY 的存在,缺少对 OPENCODE_GO_API_KEY 的验证。如果使用 opencode-go/minimax-m2.7 模型却缺少对应的 API key,会导致运行时错误。

2. 模型选择风险

workflow 硬编码使用 opencode-go/minimax-m2.7 模型,但该模型可能并非在所有区域/平台上可用。PR 的 comment 中已经出现了 ProviderModelNotFoundError 错误,这可能与此相关。

建议:在文档或 workflow comment 中说明所需的模型访问要求。

3. Output 格式变更影响

review/action.yml 中新增了严格的输出格式要求:

Output format:
- First line: the decision only
- Then a short summary
- Then "阻塞项" listing required fixes for merge; if none, write "阻塞项:无"
- Then "建议项" listing non-blocking improvements; if none, write "建议项:无"

这个格式变更如果下游有依赖旧格式的消费者,会造成兼容性问题。当前 PR 是自己消费自己,影响可控,但需要注意这一点。

小建议

  1. tests/dogfood-review-workflow.sh:18 - 可以考虑同时验证 opencode-go-api-key 的引用
  2. 添加 error handling - workflow 中没有对 step 失败的处理,建议添加 timeout-minutes 限制

结论

代码质量良好,逻辑正确,但存在 API key 验证不完整的问题可能导致后续运行失败。建议修复后再合并。

New%20session%20-%202026-04-14T09%3A13%3A46.450Z
opencode session  |  github run

@Svtter Svtter merged commit dad56ec into main Apr 14, 2026
2 checks passed
Svtter added a commit that referenced this pull request May 27, 2026
TS (platform.ts):
- Cache detectPlatform() result to avoid repeated env reads (#6)
- getRepo() returns empty string + warn instead of throw (#5)
- fetchAllGiteaComments() capped at MAX_PAGES=20 (#1)
- getGiteaToken() checks both GITEA_TOKEN and GITHUB_RUN_OPENCODE_GITEA_TOKEN (#13)
- Add /* ignore */ comments to empty catch blocks (#11)

Python (run-github-opencode.py):
- Use specific exception types: (TimeoutExpired, JSONDecodeError) not bare Exception (#2)
- Add HTTP plaintext warning for GITEA_API_URL (#3)
- Validate repo/pr format before URL construction (#4)
- Add pagination for Gitea comment listing with max_pages=20 (#1)
- Unify token lookup to GITEA_TOKEN only (#13)
Svtter added a commit that referenced this pull request May 27, 2026
* feat: add Gitea CI compatibility via platform abstraction layer

- New platform.ts: auto-detect GitHub/Gitea via GITEA_API_URL env var
- Unified interfaces for PR diff fetch, comment posting, error comment cleanup
- Gitea: tea CLI (preferred) → curl REST API fallback
- GitHub: unchanged, zero-impact on existing workflows
- comment.ts refactored to thin proxy over platform.ts
- index.ts: platform-aware diff fetch with pre-fetched file fallback
- action.yml (multi-review, review): new gitea-token input
- Python: detect_platform() + Gitea error comment cleanup

Closes #55

* fix: address AI code review feedback

- Remove dead httpRequest code and unused http/https imports (阻塞项 #1)
- Reverse diff fetch priority: pre-fetched file first, platform fetch as
  fallback to avoid duplicate API calls on GitHub (阻塞项 #2)
- Fix redundant Python exception catches (Exception covers subclasses)
- Use get_env() in detect_platform() for consistency
- Add HTTPS warning for GITEA_API_URL using plain HTTP
- Validate GITHUB_REPOSITORY format before API calls
- Lazy-cache hasTea() result to avoid repeated which calls
- Add pagination support for Gitea comment cleanup
- Revert tsup externals (https/http no longer imported)
- Remove duplicate empty-diff check in index.ts

* fix: address second round AI code review feedback

TS (platform.ts):
- Cache detectPlatform() result to avoid repeated env reads (#6)
- getRepo() returns empty string + warn instead of throw (#5)
- fetchAllGiteaComments() capped at MAX_PAGES=20 (#1)
- getGiteaToken() checks both GITEA_TOKEN and GITHUB_RUN_OPENCODE_GITEA_TOKEN (#13)
- Add /* ignore */ comments to empty catch blocks (#11)

Python (run-github-opencode.py):
- Use specific exception types: (TimeoutExpired, JSONDecodeError) not bare Exception (#2)
- Add HTTP plaintext warning for GITEA_API_URL (#3)
- Validate repo/pr format before URL construction (#4)
- Add pagination for Gitea comment listing with max_pages=20 (#1)
- Unify token lookup to GITEA_TOKEN only (#13)

* fix: address third round review feedback

- Restore error log in GitHub cleanup catch block (#1)
- Add --repo to tea pulls diff call (#2)
- Python Gitea token fallback: check both GITEA_TOKEN and GITHUB_RUN_OPENCODE_GITEA_TOKEN (#4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant