Skip to content
Back to skills

Forgejo Actions

ASecurity

排查或查看 CI / Release Actions(git.stravia.cn 上 Forgejo Actions:ci.yml、release.yml、ci-image.yml)运行状态、失败 job/step、日志或 artifacts 时使用。

  • 99 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentsgobashgitapi

Works with

  • api

Security analysis

A100/100

Scanned December 1, 2026

npx -y skills add Stravia-AI/StraviaPlatform --skill forgejo-actions --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Forgejo Actions?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Forgejo Actions
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/stravia-ai-forgejo-actions/badge)](https://www.skillsdirectory.com/skills/stravia-ai-forgejo-actions)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: forgejo-actions
description: 排查或查看 CI / Release Actions(git.stravia.cn 上 Forgejo Actions:ci.yml、release.yml、ci-image.yml)运行状态、失败 job/step、日志或 artifacts 时使用。
---

# 通过 `tea` 排查 Forgejo Actions 日志

本仓库的 Actions(`.github/workflows/`)运行在 Forgejo `https://git.stravia.cn`,仓库为 `Stravia/StraviaPlatform`(不是 GitHub 镜像 `Stravia-AI/StraviaPlatform`)。所有查询统一通过 `tea api --login git.stravia.cn` 复用本地登录态访问 REST API;`git.stravia.cn` 禁止匿名 API 访问,若未登录先确认 `tea logins list`,不读取或打印 token 原文。

## 1. 定位目标 Run

按提交 SHA、仓库内编号、工作流或状态筛选,分页查询**必须同时传 `page` 与 `limit`**(单传 `limit` 会返回全量):

```bash
# 最近失败的 ci.yml 运行
tea api --login git.stravia.cn \
  '/repos/Stravia/StraviaPlatform/actions/runs?workflow_id=ci.yml&status=failure&page=1&limit=10' \
  | jq '[.workflow_runs[] | {id, index_in_repo, workflow_id, status, prettyref, sha: (.commit_sha[0:10]), title, html_url}]'

# 按提交 SHA 或 Web 编号(#112)精确查找
tea api --login git.stravia.cn '/repos/Stravia/StraviaPlatform/actions/runs?head_sha=<FULL_SHA>'
tea api --login git.stravia.cn '/repos/Stravia/StraviaPlatform/actions/runs?run_number=<INDEX_IN_REPO>'
```

- 可选过滤参数:`workflow_id`(`ci.yml` / `release.yml` / `ci-image.yml`)、`status`(`failure`/`success`/`running`/`waiting`/`pending`/`requested`/`cancelled`)、`event`、`head_sha`、`ref`、`run_number`。
- **ID 区分**:后续 API 路径中的 `<run_id>` 使用全局 `id`(如 `2637`);Web 页面 `https://git.stravia.cn/Stravia/StraviaPlatform/actions/runs/<index_in_repo>` 与 `?run_number=` 使用仓库内编号 `index_in_repo`(如 `112`)。

完成条件:确认目标运行的 `<run_id>`、`index_in_repo`、`workflow_id`、`commit_sha` 与 `status`。

## 2. 定位失败 Job 与 Step

先列该 Run 下所有 Job(Forgejo 返回顶层 JSON 数组),再查目标 Job 的步骤清单:

```bash
# 列出 run 下的所有 job
tea api --login git.stravia.cn \
  '/repos/Stravia/StraviaPlatform/actions/runs/<run_id>/jobs' \
  | jq '[.[] | {id, name, status, attempt}]'

# 查看单个 job 的 steps(0 = Set up job,末位 = Complete job)
tea api --login git.stravia.cn \
  '/repos/Stravia/StraviaPlatform/actions/jobs/<job_id>' \
  | jq '{id, name, status, attempt, steps}'
```

完成条件:锁定待排查的 `<job_id>`、`attempt` 与失败的 `<step_number>`。

## 3. 精准切片读取日志

优先用步骤切片、尾部字节范围或服务端过滤缩小输出,避免直接拉取整份几百 KB 日志:

```bash
# 1) 只拉失败步骤的最后 8KB(206 Partial Content;Range 与 ?step= / ?attempt= 可组合)
tea api --login git.stravia.cn -H 'Range: bytes=-8000' \
  '/repos/Stravia/StraviaPlatform/actions/jobs/<job_id>/logs?step=<step_number>'

# 2) 服务端关键字过滤(纯子串,非正则;qi=true 忽略大小写;可与 ?step= 组合)
tea api --login git.stravia.cn \
  '/repos/Stravia/StraviaPlatform/actions/jobs/<job_id>/logs?step=<step_number>&q=FAILED&qi=true'

# 3) NDJSON 结构化输出(每行 {"time":"...","content":"..."},便于 jq 二次筛选)
tea api --login git.stravia.cn \
  '/repos/Stravia/StraviaPlatform/actions/jobs/<job_id>/logs?step=<step_number>&format=ndjson&q=error&qi=true'

# 4) 查看历史重试(1-based,省略默认最新 attempt)
tea api --login git.stravia.cn -H 'Range: bytes=-8000' \
  '/repos/Stravia/StraviaPlatform/actions/jobs/<job_id>/logs?attempt=<N>&step=<step_number>'

# 5) 跟随正在运行的 job(需显式传 --job)
tea actions runs logs --login git.stravia.cn --repo Stravia/StraviaPlatform --job <job_id> <run_id> -f
```

- 启用 `?q=` 或 `?format=ndjson` 时服务端会禁用 `Range:` 并返回过滤后的完整结果。
- 需离线跨多个 Job 搜索时,用 `GET` 下载整次 Run 的日志 ZIP(`HEAD` 返回 `405`;条目命名为 `{job-name}-{job-id}-attempt-{N}.log`,无日志为 `.MISSING`):
  ```bash
  tea api --login git.stravia.cn -o /tmp/run-<run_id>.zip \
    '/repos/Stravia/StraviaPlatform/actions/runs/<run_id>/logs'
  ```

完成条件:提取到指向根因的原始报错与上下文,并记录对应的 `run_id`、`index_in_repo`、`job_id` 与 `step.number`;如落地了 `/tmp/run-*.zip` 等临时文件,排查完成后删除。

## 4. 按需查看 Artifacts 与跨 Run 任务

- 查看与下载 Run 产物(如 E2E 报告、截图、构建归档):
  ```bash
  tea api --login git.stravia.cn '/repos/Stravia/StraviaPlatform/actions/runs/<run_id>/artifacts'
  tea api --login git.stravia.cn -o /tmp/artifact-<artifact_id>.zip \
    '/repos/Stravia/StraviaPlatform/actions/artifacts/<artifact_id>/zip'
  ```
- 跨 Run 扁平查看最近任务:`tea api --login git.stravia.cn '/repos/Stravia/StraviaPlatform/actions/tasks?page=1&limit=20'`。

## `tea` × Forgejo 兼容边界与操作约束

- **列表与 Job 详情走 `tea api`,不走 `tea actions runs` 子命令**:
  - `tea actions runs view --jobs <run_id>` 与不带 `--job` 的 `tea actions runs logs <run_id>` 会因 Forgejo `/jobs` 返回顶层 JSON 数组而报 `cannot unmarshal array into Go value of type gitea.ActionWorkflowJobsResponse`。
  - `tea actions runs list` 因字段差异会丢失 `WORKFLOW`/`BRANCH`/`STARTED`/`DURATION` 列。
  - 仅在已确定 `<job_id>` 且需要 `-f` 实时跟随日志时,使用 `tea actions runs logs --job <job_id> <run_id>`。
- **默认只读**:本 skill 覆盖的所有排查步骤均为只读 `GET`。取消、重跑或派发工作流(`cancel`、`rerun`、`dispatches`)会变更远端 CI 状态,仅在用户明确授权后执行。

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.