RepoRefit / 开发者工具
RepoRefit GitHub Action
自动检查每个拉取请求。Action 在你自己的 GitHub runner 上只读取文件,不需要令牌或密钥。
一个文件完成设置
在仓库中创建 .github/workflows/reporefit.yml:
name: RepoRefit
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 3 * * 1'
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: reporefit/action@v1
with:
fail-on: high运行时机
- push:每个分支的每次提交。
- pull_request:创建或更新拉取请求时,结果以文件注释的形式标在改动的行上。
- workflow_dispatch:在 Actions 页面手动运行。
- schedule:例如每周一 03:00 UTC。
输入
| 输入 | 默认值 | 含义 |
|---|---|---|
path | . | 要检查的文件夹(相对于仓库根目录)。 |
tool | all | 要运行的检查(与 CLI 相同的 ID)。 |
fail-on | high | 存在不低于该严重程度的发现时让步骤失败:high、medium、low、none。 |
lang | en | 汇总和报告的语言:en、ko、ja、zh-Hans。 |
badge | 把 README 徽章 SVG 写到此路径。 | |
ignore | 额外忽略规则,每行一个或用逗号分隔。 |
输出
可在后续步骤中使用,例如发表评论或决定下一步:
findings, high, medium, low, passed, evaluated, partial, fix-plan, report-md, report-json报告与 AI 修复指令
作业摘要中会显示 Markdown 报告。Markdown 和 JSON 报告以及 AI 修复指令会写到 runner 的临时文件夹,需要保留时请作为构件上传:
- uses: reporefit/action@v1
id: rr
with:
fail-on: medium
tool: secrets
lang: ko
- uses: actions/upload-artifact@v4
if: always()
with:
name: reporefit
path: |
${{ steps.rr.outputs.report-md }}
${{ steps.rr.outputs.report-json }}
${{ steps.rr.outputs.fix-plan }}有发现时阻止合并
发现达到 fail-on 时步骤失败(退出码 1)。在 Settings → Branches 中把该作业设为必需的状态检查,即可在通过前阻止合并。
安全
- 只给工作流 contents: read 权限,并在 checkout 中设置 persist-credentials: false。
- Action 不运行项目的脚本、构建或安装命令,只读取文件。
- 使用 pull_request 而不是 pull_request_target,避免来自 fork 的拉取请求获得写权限或密钥。
- 数据不会离开 runner:没有 RepoRefit 服务器。