Commands/cicd
/cicd:analyze
CI/CD Pipeline Analysis
/cicd:analyze
Claude Code
Agent: devops-engineer Skills: cicd-automation
/cicd:analyze - CI/CD Pipeline Analysis
Analyze GitHub Actions failures and identify root causes.
Usage
/cicd:analyze [run-id|url]
/cicd:analyze - Analyze most recent failed run
/cicd:analyze 12345678 - Analyze specific run ID
/cicd:analyze https://github.com/owner/repo/actions/runs/12345678Execution Steps
1. Identify Target Run
# If no run specified, get most recent failure
gh run list --status failure --limit 1 --json databaseId,name,conclusion,headBranch
# If URL provided, extract run ID
# https://github.com/owner/repo/actions/runs/12345678 → 123456782. Fetch Run Details
# Get run information
gh run view <run-id> --json name,status,conclusion,jobs,startedAt,updatedAt
# Get failed job logs
gh run view <run-id> --log-failed
# Download artifacts if needed
gh run download <run-id> -D /tmp/artifacts3. Analyze Failure
Parse logs for common patterns:
| Pattern | Likely Cause |
|---|---|
ENOSPC | Disk space exhausted |
ENOMEM | Memory limit exceeded |
npm ERR! 404 | Package not found |
error: failed to push | Git push conflict |
exit code 137 | OOM killed |
timeout | Step exceeded time limit |
Permission denied | Missing secrets/permissions |
4. Generate Analysis Report
## CI/CD Failure Analysis
### Run Information
- **Workflow**: {workflow-name}
- **Run ID**: {run-id}
- **Branch**: {branch}
- **Triggered By**: {actor}
- **Failed At**: {timestamp}
### Failed Job
- **Job**: {job-name}
- **Step**: {step-name}
- **Duration**: {time}
### Root Cause
{identified-issue}
### Error Log (Relevant Section){error-log-snippet}
### Recommended Fix
1. {fix-step-1}
2. {fix-step-2}
### Similar Past Failures
- {link-to-similar-issue}Agent Configuration
agent: devops-engineer
skills:
- cicd-automation
confirmation: none # Read-only analysisCommon Fixes Reference
Disk Space
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghcMemory Issues
env:
NODE_OPTIONS: --max-old-space-size=4096Flaky Tests
- name: Run tests with retry
uses: nick-fields/retry@v2
with:
max_attempts: 3
command: npm test