基于 OpenCodeReview 的 webhook 服务:监听 Gitea 的 push 与 Pull Request 事件, 调用 OCR 审查 diff,把结果发布回 Gitea,并按阻断阈值决定是否自动合并。 主要能力: - Push / PR 事件触发,支持分支 glob 过滤与 PR-only / push-only 范围 - PR 内联评论(按 diff 行号定位)、汇总评论、Issue 生命周期、提交状态 - 可配置阻断阈值(严重级别 / 类别 / 任意意见) - 无阻断问题时自动合并,审查覆盖不完整时拒绝合并 - 内置 Web 后台:仓库配置、任务日志、失败重跑、连通性自检 - SQLite 持久化,worker 重启回收卡死任务,失败自动重试 实现为独立服务而非 Gitea Action:本机 act_runner 指向的实例不可达, 且后台配置与任务历史需要独立进程承载。
36 lines
967 B
YAML
36 lines
967 B
YAML
services:
|
|
gitea-codereview:
|
|
build:
|
|
context: .
|
|
image: local/gitea-codereview:latest
|
|
container_name: gitea-codereview
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
CR_HOST: 0.0.0.0
|
|
CR_PORT: 8090
|
|
CR_DATA_DIR: /data
|
|
CR_GITEA_URL: ${CR_GITEA_URL:-http://192.168.31.51}
|
|
CR_OCR_COMMAND: ocr
|
|
TZ: Asia/Shanghai
|
|
ports:
|
|
- "${CR_HOST_PORT:-8090}:8090"
|
|
volumes:
|
|
- codereview-data:/data
|
|
# Mount a custom OCR rule file here and set the path in the UI.
|
|
# - ./rule.json:/etc/gitea-codereview/rule.json:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:8090/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 20s
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "50m"
|
|
max-file: "3"
|
|
|
|
volumes:
|
|
codereview-data: |