Skip to content

ci: 接入 PR Agent(qwen-max,非阻塞自动 review)#388

Merged
leeguooooo merged 2 commits into
mainfrom
ci/pr-agent-qwen
Jul 12, 2026
Merged

ci: 接入 PR Agent(qwen-max,非阻塞自动 review)#388
leeguooooo merged 2 commits into
mainfrom
ci/pr-agent-qwen

Conversation

@leeguooooo

Copy link
Copy Markdown
Owner

接入开源 PR-Agent(MIT)做自动 PR review,非阻塞(随时会挂不拦合并)。

  • 模型:自建端点 ai.leeguoo.com 的 qwen-max(litellm openai/ 前缀),key/base 存 GitHub Secret 不进代码。
  • 非阻塞:continue-on-error、不加 required checks;端点挂了 PR 不会变红。
  • 自动跑 review + 代码建议,中文;同仓库 PR 才拿 secret,fork PR 安全 no-op(未用 pull_request_target)。
  • 版本 pin 0.39.0-github_action

⚠️ 本 PR 自身就是活体烟测——pr-agent 会尝试 review 这个 PR。若端点通就能看到它的评论;挂了也不影响合并。

🤖 owner 指示接入。

自动 PR review:模型走自建 OpenAI 兼容端点 ai.leeguoo.com 的 qwen-max(litellm openai/ 前缀路由),
key/base 存 GitHub Secret(PR_AGENT_OPENAI_KEY / PR_AGENT_OPENAI_API_BASE),不进代码。
- 非阻塞:continue-on-error,端点随时会挂也不让 PR 变红/拦合并;不加入 required checks。
- 只自动跑 review + improve(代码建议),describe 关掉(PR 描述我们自己写得够详,省 token)。
- 中文 review(response_language=zh-cn);同仓库分支 PR 才拿 secret,fork PR 自动 no-op(不用 pull_request_target,安全)。
- 版本 pin 0.39.0-github_action,dependabot 后续跟。
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

环境变量重复

OPENAI_KEYOPENAI__KEY 两个环境变量似乎重复定义了。这可能会导致混淆或不必要的冗余。

OPENAI_KEY: ${{ secrets.PR_AGENT_OPENAI_KEY }}
OPENAI__KEY: ${{ secrets.PR_AGENT_OPENAI_KEY }}

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
删除重复的环境变量

重复的环境变量 OPENAI_KEYOPENAI__KEY 可能会导致配置冲突。建议删除其中一个以避免潜在的问题。

.github/workflows/pr-agent.yml [35-36]

 OPENAI_KEY: ${{ secrets.PR_AGENT_OPENAI_KEY }}
-OPENAI__KEY: ${{ secrets.PR_AGENT_OPENAI_KEY }}
Suggestion importance[1-10]: 8

__

Why: 删除重复的环境变量可以避免配置冲突,提高代码的清晰度和可维护性。

Medium
General
设置不同的备用模型

当前配置中,CONFIG__FALLBACK_MODELS 的值与主模型相同。建议设置不同的备用模型以提高系统的容错性。

.github/workflows/pr-agent.yml [38]

-CONFIG__FALLBACK_MODELS: '["openai/qwen-max"]'
+CONFIG__FALLBACK_MODELS: '["openai/qwen-turbo"]'
Suggestion importance[1-10]: 7

__

Why: 设置不同的备用模型可以提高系统的容错性和稳定性,但具体选择哪个备用模型需要根据实际情况来决定。

Medium
优化条件判断逻辑

当前条件判断可能会导致某些情况下不必要的执行。建议添加一个额外的检查,确保只有在 PR 评论中包含特定命令时才运行。

.github/workflows/pr-agent.yml [24-26]

 if: >-
   github.event_name == 'pull_request' ||
-  (github.event_name == 'issue_comment' && github.event.issue.pull_request)
+  (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/review') || contains(github.event.comment.body, '/improve') || contains(github.event.comment.body, '/ask'))
Suggestion importance[1-10]: 7

__

Why: 优化条件判断逻辑可以减少不必要的执行,提高流程的效率。但需要确保新增的检查不会引入新的问题。

Medium

runner 显式读 OPENAI_KEY/OPENAI.KEY,双下划线那个多余。pr-agent 在 #388 自审时挑出,采纳。
@leeguooooo leeguooooo merged commit 1fabd7f into main Jul 12, 2026
20 checks passed
@leeguooooo leeguooooo deleted the ci/pr-agent-qwen branch July 12, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant