ci-diagnosis-and-fix
Skill1 starsChanged 3 months agoMITView on GitHub
Diagnose and fix GitHub Actions CI when workflows turn systematically red — systematic triage and repair flow for pipeline failures. Use when CI is failing wholesale, when asked to fix pipeline/action errors, or when reviewing workflow configurations. 诊断并修复 CI 系统性变红的 GitHub Actions 工作流——管道失败的系统化分流与修复流程。当 CI 批量失败、要求修复 pipeline/action 错误或审查工作流配置时使用。
- Installs packages
In this repository5 other files it gives its agents.
- code-review-methodologySkill
- redundancy-and-boundary-auditSkill
- release-engineeringSkill
- repo-analysisSkill
- shell-safetySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
When GitHub Actions CI turns systematically red, triage and fix it with this flow instead of patching workflows one at a time.
- Very specific: line 33
Use the token as a Bearer token.
- Very specific: line 86
If playwright.config.ts already declares a webServer, do NOT start the app separately in the workflow — Playwright manages it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CI Failure Diagnosis & Repair
When GitHub Actions CI turns systematically red, triage and fix it with this flow instead of patching workflows one at a time.
Flow Overview
Trigger (failed run notification / manual request)
→ find the workflow run via the GitHub API
→ pull the failing job's log
→ classify the root cause
→ fix
→ verifyPrerequisites
- GitHub Token with
repo+workflow+actions: readpermissions (a classic PAT withreposcope suffices).
Diagnosis Flow (Step-by-Step)
1. Find the failing workflow run
GET /repos/{owner}/{repo}/actions/runs?per_page=10&status=failureUse the token as a Bearer token. Focus on run_number, name, head_branch, conclusion, html_url. Prefer the most recent run on the branch you care about; check whether multiple workflows failed on the same commit.
2. Find the failing job
GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobsWalk jobs[].steps[] and locate the step with conclusion == "failure".
3. Download the failing step's log
GET /repos/{owner}/{repo}/actions/runs/{run_id}/logsReturns a zip; extract only the failing step's log, not everything (logs can be huge). Decode with utf-8-sig (GitHub logs carry a BOM). Read the last 2000–3000 characters of the failing step.
4. Classify the root cause
| Error signature | Common root cause | Fix direction |
No matching distribution found for X | dependency version does not exist / incompatible | pin a released version or bump the CI Python |
ModuleNotFoundError | missing dependency / wrong import path | add the dependency or fix the import |
assert ... failed / red tests | code logic | fix the code |
Process completed with exit code 1 (no clear error) | environment / timeout | read the full log |
SyntaxError / TypeError | Python version incompatibility | fix code or align versions |
Timeout | slow tests / network | raise the timeout or fix the slow path |
Multiple workflows failing at the same time on the same commit → almost always a dependency/environment problem, not code. One broken shared dependency cascades into "everything red".
5. Compare history
Repeated failures on the same branch over many runs → a persistent problem, not a flake. Check whether the last ~30 failed runs cluster on a specific commit range (a single broken merge).
Common Fixes
GITHUB_OUTPUT delimiter syntax
The old echo "k=v" >> "$GITHUB_OUTPUT" syntax fails on newer runners (Invalid format). Use the delimiter form, which works everywhere:
# Old (fails on Node 24 runners)
echo "count=$ERROR_COUNT" >> "$GITHUB_OUTPUT"
# New (delimiter syntax)
echo "count<<EOF" >> "$GITHUB_OUTPUT"
echo "$ERROR_COUNT" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"Playwright E2E — let webServer manage the dev server
If playwright.config.ts already declares a webServer, do NOT start the app separately in the workflow — Playwright manages it.
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Run Playwright tests # Playwright auto-starts webServer
run: npx playwright test
env:
CI: "true"Dependency files — surgical edits only
Rewrite only the offending line, never the whole file. git show HEAD:requirements.txt gives you the original; a full rewrite loses version pins and indirect dependencies.
Verification after a fix
pip install -r requirements.txt --dry-run— confirm the dependency set resolves- Grep every workflow that uses
$GITHUB_OUTPUTand confirm it uses the delimiter form - Confirm no duplicate dev-server starts / port conflicts (Playwright webServer vs manual start)
Notes
- Encoding: Windows consoles default to cp1252; avoid
✗✓★◆etc. inprint()output, use[FAIL]/[OK]ASCII markers. - BOM: GitHub log zips carry a UTF-8 BOM (
\ufeff); decode withutf-8-sig. - Token scope: pulling logs requires
repo+workflow(actions: read). - Batch failure pattern: many workflows red at the same commit ⇒ dependency/environment issue, not N separate code bugs.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

