Diagnoses and fixes CI/CD failures in GitHub Actions workflows. Use when CI is failing on a PR, builds are broken, or tests pass locally but fail in CI.
68
83%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
When asked to diagnose or fix CI/CD failures (e.g., "Why is CI failing on PR #999?", "Fix the failing build"), follow this workflow to identify the root cause and optionally implement fixes.
Attach this file to your Copilot Chat context, then invoke it with a failing PR number, branch, or CI run context. Use Option A for diagnosis-only requests and Option B when the user explicitly asks for a fix.
Get CI Status:
gh pr checks #999gh run list --branch <branch-name> --limit 5Categorize the Failure Type:
Identify Specific Failing Steps:
CRITICAL: CI logs can be massive (100K+ lines) and exceed token limits.
Get the Run ID:
gh run list --branch <branch> --limit 1 --json databaseId --jq '.[0].databaseId'Fetch Failed Job Logs Only:
gh run view <run-id> --log-failedThis limits output to only failed jobs, making it manageable.
Extract Key Error Information:
For test failures: Look for stack traces, assertion errors, specific test names
For linter failures: Extract file names, line numbers, and violation types
For build failures: Find dependency errors or missing packages
Use grep to filter logs if still too large:
gh run view <run-id> --log-failed | grep -A 10 -B 5 "Error\|FAILED\|Failure"Avoid Full Log Downloads:
--log without --log-failed unless specifically requestedBased on the failure type, investigate:
For Test Failures:
For Linter Failures:
bundle exec rubocop and bundle exec rake yardFor Build Failures:
Gemfile and git.gemspecFor Timeout Failures:
For PR Failures:
Fetch the PR branch:
gh pr checkout #999Run the failing tests locally:
bundle exec rspec <path/to/spec.rb>Run linters:
bundle exec rubocop
bundle exec rake yardFor Branch Failures:
Checkout the branch.
Run full CI workflow:
bundle exec rake defaultDetermine the appropriate action based on the user's request:
Present findings to the user:
# CI Failure Diagnosis: <Branch/PR>
**Status:** <X of Y jobs failed>
## Failed Jobs
1. **<Job Name>** (<Ruby version>, <OS>)
- **Step:** <failing step name>
- **Failure Type:** <test/linter/build/timeout>
## Root Cause
<Explanation of what's causing the failure>
## Error Details
```
<Relevant error messages and stack traces>
```
## Recommendations
- <Specific fix suggestion 1>
- <Specific fix suggestion 2>
**Would you like me to implement a fix, or do you need more information?**STOP here unless the user asks you to proceed with fixes.
Proceed based on failure type:
style: fix rubocop violations in lib/git/base.rb)For PR Failures on Someone Else's PR:
After implementing fixes:
Run Affected Tests Locally:
bundle exec rspec <path/to/spec.rb>Run Full CI Suite:
bundle exec rake defaultPush and Monitor:
Push the fixes
Monitor CI to confirm the fix worked:
gh run watchConfirm Resolution:
Fix implemented and pushed. Monitoring CI run...
CI Status: <link to run>Platform-Specific Failures:
/ vs. \)Flaky Tests:
Permission Issues:
Token Limit Management:
--log-failed to limit outputgrep to extract errors8887679
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.