Add .github/workflows/gatekeep-pr.yml with uses: ./ and OPENROUTER_API_KEY from secrets. Forge-agnostic API helper for Gitea.
This commit is contained in:
commit
05f8fad38a
48 files changed
+2844
No files matched your search
@@ -0,0 +1,85 @@
|
||||
# Gatekeep
|
||||
|
||||
AI 辅助的 PR 审查 Action:多模型并行投票、按严重级别输出可扫读的结论,适合自己的仓库。
|
||||
|
||||
## 它做什么
|
||||
|
||||
- 对每个 PR 并行调用 **2–3 个模型**(**可来自不同供应商**),**仅当多个模型达成一致**时发 inline 评论。
|
||||
- 每条结论明确写出:**严重级别**、**代码位置**、**为什么重要**。
|
||||
- 汇总评论给出 PR **风险档**(low / medium / high);安全相关可阻断合并。
|
||||
- 不提供 CodeRabbit 式聊天 / `@命令`。
|
||||
|
||||
## 远程引用(推荐)
|
||||
|
||||
工作流文件必须放在 **`.github/workflows/`**(Gitea / GitHub 都认这个路径)。
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v4
|
||||
- uses: https://git.potatolab.uk/layue13/gatekeep@main
|
||||
# 占位:uses: https://git.example.com/OWNER/gatekeep@v1
|
||||
env:
|
||||
# 必须与 providers.yaml 里的 key 同名(自由命名,无强制 gatekeep_ 前缀)
|
||||
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
### 自审(本仓库 dogfood)
|
||||
|
||||
`layue13/gatekeep` 用 [`.github/workflows/gatekeep-pr.yml`](.github/workflows/gatekeep-pr.yml) 对本仓库 PR 跑 Gatekeep:`uses: ./` + `secrets.OPENROUTER_API_KEY`。向 `main` 开 PR 即可触发(需有可用的 Gitea Actions runner)。
|
||||
|
||||
github.com runner 若不允许非 github.com Action 源,见 `docs/remote-uses.md`。
|
||||
|
||||
## 多供应商(providers.yaml)
|
||||
|
||||
```yaml
|
||||
providers:
|
||||
openrouter:
|
||||
key: OPENROUTER_API_KEY # 自由命名 — 任意 secret/环境变量名
|
||||
protocol: openai # openai | openai-completions | openai-responses | anthropic
|
||||
models:
|
||||
- google/gemma-4-31b-it:free
|
||||
- google/gemma-4-26b-a4b-it:free
|
||||
- cohere/north-mini-code:free
|
||||
- nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free
|
||||
```
|
||||
|
||||
- **`key`:自由命名**,**不要**要求必须 `gatekeep_` 前缀(你也可以叫 `gatekeep_openrouter`,只是举例)。
|
||||
- 每个供应商只需:`key` + `protocol`(`base_url` / `models` 按需;已知 id 有默认 base_url)。
|
||||
- **不内置死模型清单**;启动时拉取供应商模型列表并校验名字。
|
||||
- 可混用多个供应商;只写你真正配置了的条目。
|
||||
|
||||
## 输入面
|
||||
|
||||
| 项 | 含义 |
|
||||
| --- | --- |
|
||||
| `key` | Secret / 环境变量名(自由) |
|
||||
| `protocol` | `openai` / `openai-completions` / `openai-responses` / `anthropic` |
|
||||
| `models` | 参与并行审查的模型名 |
|
||||
| step `env` | 把 `key` 同名的 secret 注入环境 |
|
||||
| `github-token` | 发评论 / checks |
|
||||
|
||||
## 混用示例
|
||||
|
||||
```yaml
|
||||
- uses: https://git.potatolab.uk/layue13/gatekeep@main
|
||||
env:
|
||||
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
config-dir: .github/gatekeep # 内含 providers.yaml,见 config/providers.yaml
|
||||
```
|
||||
|
||||
## 风险档
|
||||
|
||||
| 档 | 人工 |
|
||||
| --- | --- |
|
||||
| low | 0(审查与安全绿后;kill switch 可自动合并) |
|
||||
| medium | 1 人(Bot 不能顶替) |
|
||||
| high | 2 人 |
|
||||
|
||||
## 更多
|
||||
|
||||
- 英文:`README.md`
|
||||
- 远程限制:`docs/remote-uses.md`
|
||||
Reference in new issue
Block a user