跳到正文
Skillpedia
部署与云(DevOps)10k · #11898

gha

它能做什么

这个技能根据链接调查失败的 GitHub Actions 运行记录。它会找出失败的真正原因,然后检查过去的运行记录,看问题是否反复出现。适合经常遇到构建失败的开发者。

适用场景

  • ✓当某次 GitHub Actions 运行失败,并且你想知道确切原因的时候。
  • ✓当工作流中的某个任务时好时坏,并且你想知道它失败的频率的时候。
  • ✓当你想找到第一次导致某个任务开始失败的提交的时候。

技能链接

https://github.com/ykdojo/claude-code-tips/blob/main/skills/gha/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ykdojo/claude-code-tips/blob/main/skills/gha/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请查看这次失败的 GitHub Actions 运行记录,告诉我原因,以及它是否会一再发生。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能使用 GitHub 命令行工具读取运行日志,找出失败的原因。然后它会检查同一任务最近的运行记录,以了解其成功率以及最近一次通过的时间。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Investigate this GitHub Actions URL: $ARGUMENTS

Use the gh CLI to analyze this workflow run. Your investigation should:

  1. Get basic info & identify actual failure:

    • What workflow/job failed, when, and on which commit?
    • CRITICAL: Read the full logs carefully to find what SPECIFICALLY caused the exit code 1
    • Distinguish between warnings/non-fatal errors vs actual failures
    • Look for patterns like "failing:", "fatal:", or script logic that determines when to exit 1
    • If you see both "non-fatal" and "fatal" errors, focus on what actually caused the failure
  2. Check flakiness: Check the past 10-20 runs of THE EXACT SAME failing job:

    • IMPORTANT: If a workflow has multiple jobs, you must check history for the SPECIFIC JOB that failed, not just the workflow
    • Use gh run list --workflow=<workflow-name> to get run IDs, then gh run view <run-id> --json jobs to check the specific job's status
    • Is this a one-time failure or recurring pattern for THIS SPECIFIC JOB?
    • What's the success rate for THIS JOB recently?
    • When did THIS JOB last pass?
  3. Identify breaking commit (if there's a pattern of failures for the specific job):

    • Find the first run where THIS SPECIFIC JOB failed and the last run where it passed
    • Identify the commit that introduced the failure
    • Verify by checking: does THIS JOB fail in ALL runs after that commit? Does it pass in ALL runs before?
    • If verified, report the breaking commit with high confidence
  4. Root cause: Based on logs, history, and any breaking commit, what's the likely cause?

    • Focus on what ACTUALLY caused the failure (not just any errors you see)
    • Verify your hypothesis against the logs and failure logic
  5. Check for existing fix PRs: Search for open PRs that might already address this issue:

    • Use gh pr list --state open --search "<keywords>" with relevant error messages or file names
    • Check if any open PR modifies the failing file/workflow
    • If a fix PR exists, note it in your report and skip the recommendation section

Write a final report with:

  • Summary of failure (what specifically triggered the exit code 1)
  • Flakiness assessment (one-time vs recurring, success rate)
  • Breaking commit (if identified and verified)
  • Root cause analysis (based on the ACTUAL failure trigger)
  • Existing fix PR (if found - include PR number and link)
  • Recommendation (skip if fix PR already exists)
常见问题

它需要 GitHub 访问权限吗?

需要。它使用 gh 命令行工具,因此你需要登录并拥有该仓库的访问权限。

它会检查工作流中的每个任务吗?

它只检查失败的那个任务,而不是整个工作流,因此历史记录针对的是正确的任务。

它会替我修复失败吗?

该技能专注于找出原因以及引入问题的提交。

详情

作者的原始描述

Analyze GitHub Actions failures and identify root causes

repo: ykdojo/claude-code-tips

热度

GitHub 星标
10k
排名
#11898
许可证
—
更新时间
2026/9/25

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能