0%

5 分钟快速上手

前置条件

  • OpenClaw 已部署并运行
  • GitHub 仓库的 Settings 权限
  • 一个 Anthropic API Key(Claude)或其他支持的 LLM API Key

步骤 1:部署 PR 审查官 Agent

configs/ 目录下的配置文件复制到 OpenClaw 实例:

1
2
3
4
5
6
7
8
# 假设 OpenClaw 安装在 ~/openclaw
cp configs/openclaw-agent.yml ~/openclaw/agents/pr-reviewer/agent.yml
cp configs/architecture-agent.yml ~/openclaw/agents/pr-reviewer/
cp configs/quality-agent.yml ~/openclaw/agents/pr-reviewer/
cp configs/security-agent.yml ~/openclaw/agents/pr-reviewer/

# 复制 Prompt 模板
cp prompts/*.md ~/openclaw/agents/pr-reviewer/prompts/

步骤 2:配置环境变量

1
2
3
4
# 在 OpenClaw 环境变量中配置
export ANTHROPIC_API_KEY="your-api-key"
export GITHUB_TOKEN="your-github-token"
export WEBHOOK_SECRET="your-webhook-secret"

步骤 3:配置 GitHub Webhook

  1. 进入 GitHub 仓库 → Settings → Webhooks → Add webhook
  2. Payload URL:https://your-openclaw-domain/webhook/pr-review
  3. Content type:application/json
  4. Events:选择 “Pull requests”
  5. Secret:填入你设置的 WEBHOOK_SECRET

步骤 4:测试

创建一个测试 PR,观察:

  1. Webhook 是否被触发(GitHub webhook 设置页可以看到交付记录)
  2. OpenClaw 是否收到请求(查看日志)
  3. PR Comment 是否被回写

步骤 5:自定义 Prompt

根据团队的代码规范调整审查 Prompt:

1
2
3
4
5
# 编辑架构审查 Prompt
vim ~/openclaw/agents/pr-reviewer/prompts/architecture-review.md

# 重启 OpenClaw 使配置生效
openclaw restart

完整部署文档

参见 deployment.md。自定义指南参见 prompt-customization.md