74 lines
2.6 KiB
YAML
74 lines
2.6 KiB
YAML
name: PR-Agent
|
||
|
||
on:
|
||
# 使用 pull_request_target 让同仓库与外部 fork PR 都能自动运行 PR-Agent,
|
||
# 并在 synchronize 事件跟进每次新 commit。
|
||
# 本 workflow 不 checkout / 执行 PR 分支代码,只让 digest-pinned PR-Agent 镜像通过 GitHub API 读取 diff。
|
||
pull_request_target:
|
||
types: [opened, reopened, ready_for_review, synchronize]
|
||
|
||
issue_comment:
|
||
types: [created]
|
||
|
||
jobs:
|
||
pr_agent_job:
|
||
# PR 与每次新 commit 自动运行;评论触发仍限制为可信成员,避免任意评论滥用 Secrets。
|
||
if: >-
|
||
${{
|
||
github.event.sender.type != 'Bot' &&
|
||
(
|
||
github.event_name == 'pull_request_target' ||
|
||
(
|
||
github.event_name == 'issue_comment' &&
|
||
github.event.issue.pull_request &&
|
||
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
|
||
)
|
||
)
|
||
}}
|
||
|
||
runs-on: ubuntu-latest
|
||
|
||
permissions:
|
||
# PR-Agent 需要在 PR/issue 上评论,并通过 GitHub API 读取 diff/文件内容。
|
||
issues: write
|
||
pull-requests: write
|
||
contents: read
|
||
|
||
steps:
|
||
- name: Run PR Agent
|
||
# Pin the actual PR-Agent container image because this job can access repo Secrets.
|
||
uses: docker://pragent/pr-agent@sha256:a0b36966ca3a197ca739fa1e65c16703076fc1c744cd423ca203b8c21707d71c
|
||
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
||
# DeepSeek API Key
|
||
OPENAI_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
|
||
OPENAI__KEY: ${{ secrets.DEEPSEEK_API_KEY }}
|
||
|
||
# DeepSeek 官方 OpenAI-Compatible API
|
||
OPENAI.API_BASE: "https://api.deepseek.com/v1"
|
||
OPENAI__API_BASE: "https://api.deepseek.com/v1"
|
||
OPENAI_API_BASE: "https://api.deepseek.com/v1"
|
||
OPENAI_BASE_URL: "https://api.deepseek.com/v1"
|
||
|
||
# 中文输出
|
||
pr_reviewer.response_language: "zh-CN"
|
||
pr_description.response_language: "zh-CN"
|
||
pr_code_suggestions.response_language: "zh-CN"
|
||
|
||
# 模型配置
|
||
config.model: "openai/deepseek-v4-flash"
|
||
config.fallback_models: '["openai/deepseek-v4-flash"]'
|
||
config.custom_model_max_tokens: "1048576"
|
||
|
||
# DeepSeek 支持 temperature
|
||
config.temperature: "0.2"
|
||
|
||
# 自动执行配置
|
||
github_action_config.auto_review: "true"
|
||
github_action_config.auto_describe: "true"
|
||
github_action_config.auto_improve: "false"
|
||
|
||
# 允许 synchronize 事件触发 PR-Agent
|
||
github_action_config.pr_actions: '["opened", "reopened", "ready_for_review", "synchronize"]' |