Runnable reference implementation of the merged gitlink-gatekeeper Skill: collect -> route -> decide (deterministic 0-100 scorecard, three-state verdict) -> write-back (comment + label + tracking issue, --apply gated, never auto-merge). - scripts/gatekeeper_workflow.py: single-PR gate loop (pure stdlib, py>=3.9) - scripts/gatekeeper_sweep.py: repo-wide triage — real run over all 113 open PRs of this repo (read-only): PASS 105 / COMMENT 6 / REQUEST_CHANGES 2, avg 88.5 - findings.example.json: real code-review findings of a real PR diff (verifiable line numbers) - ci-example/: Gitea Actions integration (exit code 2 = REQUEST_CHANGES as CI gate) - docs: architecture / quickstart / runbook / verification (real-platform evidence) - tests/test_scoring.py: determinism regression guard (green) Closes the sub-task-3 loop on top of the label command (#89) and the gitlink-gatekeeper Skill (#90), sharing one policy file across all three layers. |
||
|---|---|---|
| .. | ||
| README.md | ||
| gatekeeper.gitea.yml | ||
README.md
CI 集成示例 —— 门禁接 CI
本目录演示如何把 gitlink-gatekeeper 的 PR 看门人门禁接到 CI 上,让裁决直接挡住不达标的 PR。
这是示例,不是开箱即用的生产配置;
gitlink-cli的安装方式、PR 编号字段名需按你的 runner 实际情况调整。
文件
gatekeeper.gitea.yml:Gitea Actions 工作流(GitLink 基于 Gitea,语法与 GitHub Actions 兼容)。
用法
- 把
gatekeeper.gitea.yml复制到目标仓库的.gitea/workflows/目录。 - 在仓库 Settings → Actions → Secrets 新增
GITLINK_TOKEN,值为有权读取该仓库 PR 的访问令牌(供gitlink-cli认证)。Token 切勿写进仓库或日志。 - 提一个 PR 触发工作流即可。
工作原理
- 触发:PR 的
opened/synchronize/reopened事件。 - 步骤:检出 → 准备 Python 3.9(脚本纯标准库,无需装依赖)→ 装
gitlink-cli→ 跑scripts/gatekeeper_workflow.py采集本次 PR 上下文并评分裁决。 - 退出码即门禁:
0= PASS / COMMENT → job 通过,放行。2= REQUEST_CHANGES → 工作流把它转成 job 失败,挡住该 PR。1= 可预期错误(缺参数 / 未装gitlink-cli等)→ 同样失败。
- 产物:评分卡与
summary.json落在outputs/,工作流用upload-artifact上传,便于在 CI 页面查看裁决依据。
调门禁松紧只需改 --policy 指向的 gatekeeper.yaml(策略字段说明见 gitlink-gatekeeper Skill REFERENCE)。