♻️ refactor(gitea-fix-ci): centralize evidence fallback routing
This commit is contained in:
@@ -40,8 +40,16 @@ python <skill-dir>/scripts/fetch_ci_logs.py --use-git-credential runs --status f
|
||||
- 所有携带凭据的请求必须使用 HTTPS;认证 header 只发送到配置的 Gitea 同源地址,
|
||||
跨源请求和跨源重定向会被拒绝。凭据不会出现在命令参数、日志或异常文本中。
|
||||
|
||||
脚本不可用(未装 Python、旧版 Gitea 无 job-log API、脱离 Gitea 环境)时,回退到
|
||||
下文的手动 `tea`/API/web 路径。
|
||||
### 取证路径选择
|
||||
|
||||
在 steps 2–4 沿同一条路径完成 run、job 与日志取证,不要在路径之间无依据跳转:
|
||||
|
||||
| 触发条件 | 取证路径 |
|
||||
| --- | --- |
|
||||
| 随附脚本可运行且 Actions API 可用 | 使用 `fetch_ci_logs.py` 的 `version` → `runs` → `jobs` → `logs` |
|
||||
| 脚本不可用,但 `tea actions` 或 Actions API 可用 | 使用下文对应的 `tea` 命令或 REST 端点 |
|
||||
| Actions API 返回 404,旧版实例仍有 Actions web UI | 使用 legacy web 页面定位 run、失败 job index 与日志 |
|
||||
| 无法远端访问,但用户提供日志 | 以粘贴日志为证据,并明确标注远端 run/job 未核验 |
|
||||
|
||||
## 适用场景
|
||||
|
||||
@@ -83,7 +91,7 @@ python <skill-dir>/scripts/fetch_ci_logs.py --use-git-credential runs --status f
|
||||
匿名的顺序选择。注意:`version` 只读 `/api/v1/version`,成功仅代表连通与鉴权
|
||||
可用,**不代表 Actions API 一定可用**。Actions 端点是否存在需在后续
|
||||
`runs`/`jobs` 步骤中实际验证;旧版 Gitea(见下)会在此才暴露 404。
|
||||
- 脚本不可用时,回退到手动方式。优先使用已安装并已认证的 `tea`:
|
||||
- 选择 `tea` 路径时,先确认已安装并已认证:
|
||||
- `tea login list`
|
||||
- 使用前先运行 `tea actions --help` 确认已安装的 `tea` 版本存在 `actions`
|
||||
子命令;并非所有版本都带这些子命令。
|
||||
@@ -108,7 +116,7 @@ python <skill-dir>/scripts/fetch_ci_logs.py --use-git-credential runs --status f
|
||||
- 优先用脚本:`fetch_ci_logs.py runs --status failure --branch <branch>`
|
||||
(也支持 `--sha`/`--event`/`--limit`),已知 run ID 时用
|
||||
`fetch_ci_logs.py jobs <run-id>` 直接列出各 job 并标注失败项。
|
||||
- 脚本不可用时回退到手动方式。已知 run ID 时,直接获取该 run。
|
||||
- 使用 `tea`、API 或 web 路径且已知 run ID 时,直接获取该 run。
|
||||
- 否则按分支、事件、状态或 commit SHA 过滤,列出最近的 workflow runs。
|
||||
- API 模式:
|
||||
- `GET /api/v1/repos/<owner>/<repo>/actions/runs`
|
||||
@@ -125,7 +133,7 @@ python <skill-dir>/scripts/fetch_ci_logs.py --use-git-credential runs --status f
|
||||
- 优先用脚本:`fetch_ci_logs.py logs <job-id>`。它把日志存到受跟踪源码路径
|
||||
之外的临时文件、只回显尾部若干行,并打印临时文件路径供进一步查看
|
||||
(`--tail N` 调整行数,`--json` 输出结构化结果)。
|
||||
- 脚本不可用时回退到手动方式。对每个失败的 job,下载其日志:
|
||||
- 使用 API 路径时,对每个失败的 job 下载日志:
|
||||
- `GET /api/v1/repos/<owner>/<repo>/actions/jobs/<job_id>/logs`
|
||||
- 在较旧 Gitea 的 web 回退(无 job-log API)下,按 UI 的 job index 下载日志:
|
||||
- `GET /<owner>/<repo>/actions/runs/<run>/jobs/<job-index>/logs`
|
||||
|
||||
Reference in New Issue
Block a user