feat: Gitea 自动代码审查服务
基于 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 指向的实例不可达, 且后台配置与任务历史需要独立进程承载。
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
# Gitea Code Review service.
|
||||
#
|
||||
# OCR is invoked as a subprocess from the app container, so the image ships
|
||||
# Node.js, git (>= 2.41, required by OpenCodeReview) and the ocr CLI itself.
|
||||
FROM node:22-trixie-slim
|
||||
|
||||
ARG OCR_VERSION=1.12.7
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
NODE_ENV=production \
|
||||
CR_DATA_DIR=/data \
|
||||
CR_HOST=0.0.0.0 \
|
||||
CR_PORT=8090
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends git ca-certificates tini \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& git --version \
|
||||
&& npm install -g "@alibaba-group/open-code-review@${OCR_VERSION}" \
|
||||
&& ocr version
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json ./
|
||||
COPY app ./app
|
||||
|
||||
RUN mkdir -p /data
|
||||
|
||||
EXPOSE 8090
|
||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||
CMD ["node", "app/server.js"]
|
||||
Reference in New Issue
Block a user