Communitygithub.com

reyalka/astro

分析最近的 GitHub Actions 工作流运行,识别模式、错误和改进点。当被要求“分析工作流日志”、“审查 Action 运行”或“分析 GitHub Actions”时使用。

astro 是什么?

该技能用于自动分析 GitHub Actions 工作流的运行日志,帮助开发者快速定位问题并优化 CI/CD 流程。它通过获取指定工作流的最新运行记录,深入到每一步的日志中,评估每一步的正确性、效率、指令遵守情况等。支持根据工作流文件、仓库和运行数量进行定制化分析,并能生成包含运行摘要、跨运行模式识别和优先级改进建议的综合报告。适用于任何使用 GitHub Actions 的项目,尤其适合处理复杂、多步骤的工作流。用户只需提供工作流名称,技能便会自动完成日志获取、步骤边界识别、子代理分析和报告合成。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/reyalka/astro/tree/HEAD/.agents/skills/analyze-github-action-logs

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

分析 GitHub Action 日志

获取并分析指定工作流的最近 GitHub Actions 运行记录。审查代理/步骤的性能,识别浪费的精力和错误,并生成包含可操作改进建议的报告。

输入

你需要准备:

  • workflow(必需)— 工作流文件名或 ID(例如:issue-triage.yml、deploy.yml)。
  • repo(可选)— GitHub 仓库,格式为 OWNER/REPO。默认为 withastro/astro。
  • count(可选)— 要分析的最近已完成运行数量。默认为 5。

步骤 1:列出最近的运行

获取工作流最近完成的运行。通过 --status=completed 进行过滤:

gh run list --workflow=<workflow> -R <repo> --status=completed -L <count>

展示列表以便你进行了解:运行 ID、标题、状态(成功/失败)以及持续时间。选择要分析的运行——如果可能,优先选择成功和失败的混合,并优先选择执行了更多步骤的运行(较长的运行通常会经历更多阶段,而较短的运行可能提前退出)。

步骤 2:获取日志

对于你想要分析的每次运行,将完整日志保存到临时文件:

gh run view <run_id> -R <repo> --log > /tmp/actions-run-<run_id>.log

步骤 3:识别步骤/技能边界

搜索每个日志文件,寻找指示每个步骤或技能开始和结束的标记。标记取决于工作流——查找以下模式:

  • Flue 技能标记:[flue] skill("..."): starting / completed
  • GitHub Actions 步骤标记:日志输出中的步骤名称标题
  • 自定义标记:工作流使用的任何 START/END 或类似分隔符
grep -n "skill(\|step\|START\|END\|starting\|completed" /tmp/actions-run-<run_id>.log | head -50

由此确定每个步骤/技能对应的行范围。同时查找任何结果标记:

grep -n "RESULT_START\|RESULT_END\|extractResult" /tmp/actions-run-<run_id>.log

注意:某些日志文件可能包含二进制/空字节。如有需要,请使用 grep -a。

步骤 4:分析每个步骤(使用子代理)

对于每个已执行的步骤/技能,启动一个子代理来分析该部分的日志。这对于避免数千行日志污染你的上下文至关重要。

对于每个子代理,提供以下信息:

  1. 日志文件路径以及该步骤的行范围
  2. 如果工作流有技能指令文件,告知子代理先阅读它们以获取上下文
  3. 运行标题/上下文,以便子代理理解正在执行的任务
  4. 以下分析标准

分析标准

告知每个子代理评估以下内容:

  1. 正确性 — 步骤的最终结果/结论是否正确?
  2. 效率 — 花费了多长时间?合理的基准是什么?时间浪费在哪里?
  3. 错误 — 错误的工具调用、未经更改就重试失败的命令、不必要的重新构建等。
  4. 指令遵守情况 — 如果存在技能指令,代理是否遵循了它们?在哪里偏离了?
  5. 范围蔓延 — 代理是否执行了属于其他步骤的工作?
  6. 建议 — 具体的、可操作的变化,可以防止发现的问题。

告诉每个子代理返回一个结构化响应,包含:摘要、时间分析、发现的问题(包括每个问题估计浪费的时间)以及改进建议。

步骤 5:整合报告

在所有子代理返回后,将它们的发现综合成一份报告。结构如下:

每次运行的摘要表

对于分析的每次运行,包含一个表格:

步骤/技能时间结果浪费的时间主要问题

跨运行模式

识别出现在多个运行或多个步骤中的问题。这些是最有价值的改进点。要查找的常见模式:

  • TodoWrite 滥用 — 代理在自动化运行期间浪费时间管理任务列表
  • 服务器管理失败 — 端口冲突、进程终止失败、过时的日志文件
  • 工具误用 — 使用 curl 而非 gh、jq 未找到等。
  • 范围蔓延 — 某个步骤执行了属于另一个步骤的工作
  • 不必要的重建 — 未经更改就多次构建包
  • 测试超时 — 运行耗时的 E2E/Playwright 测试导致超时
  • 指令违规 — 代理执行了指令明确禁止的操作
  • 冗余工作 — 重复读取文件、重复运行搜索、重复安装依赖项

优先级建议

按照所有运行中估计的时间节省量对你的改进建议进行排序。对于每个建议:

  1. 要更改什么 — 要编辑哪些文件以及要添加/修改什么
  2. 原因 — 解决了什么模式,附上来自运行的证据
  3. 预期影响 — 每次运行可以节省多少时间

输出

呈现完整的整合报告。不要编辑任何工作流或技能文件——仅报告发现和建议。用户将决定应用哪些更改。

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

reyalka/astro

Independently implement and validate an alternative solution for an Astro pull request. Use only for Factory's adversary blue team.

reyalka/astro

Qualify and compare red and blue solutions for an Astro pull request using Astro-specific merge and tie-break criteria. Use only for Factory's adversary purple team.

reyalka/astro

Perform a static, read-only code review of an Astro pull request or of a local branch, commit range, diff, patch, or working tree being prepared as a pull request. Determine whether the change satisfies its stated business requirements and is good enough to merge, using the PR description, linked requirement issues and roadmap items, and PR or issue discussions when available. Use this skill only for PR review or self-review, not issue triage or bug investigation. It reports only merge-relevant findings and never edits code or runs project code, tests, builds, checks, or scripts.

reyalka/astro

Comprehensive guide for developing in the Astro monorepo. Covers architecture, debugging, testing, and critical constraints. Use when working on features, fixes, tests, or understanding the codebase structure.

reyalka/astro

Write and update Astro pull requests with reviewer-friendly titles and high-signal bodies. Trigger whenever the user asks to create a PR, open a PR, draft a PR, update PR title/body, or write PR notes/summary/description.

reyalka/astro

Handle main-to-next merge tasks including conflict resolution, changeset cleanup, and CI fix-ups. Use when merging main into next.

reyalka/astro

How to write JSDoc (/** */) and inline (//) comments in the Astro codebase, for contributors reading the source — not end users. Use whenever writing or editing comments in .ts/.js source, including comments added incidentally while fixing bugs or building features. Does not cover the @docs-generated config/error reference.

相关技能