| name | ci-health-check |
| description | Check CI/CD workflow status and troubleshoot failing checks in GitHub Actions |
| group | devops |
| keywords | ["ci-cd","github-actions","troubleshooting","workflows","ci","cd","continuous integration"] |
| version | 1.0.0 |
| author | docent |
CI/CD Health Check Runbook
Overview
This runbook provides procedures for checking the health of CI/CD pipelines running on GitHub Actions. Use this runbook to:
- Check status of workflow runs
- Troubleshoot failing checks
- Re-run failed workflows
- Analyze logs and diagnose issues
Expected duration: 5-10 minutes for status check; additional time for troubleshooting
Prerequisites
Required Tools
gh CLI (GitHub CLI) - installed and authenticated
git command line tool
- Terminal access
Required Access
- Read access to the repository
- For fixing issues: Write access to create branches and PRs
Pre-Flight Checklist
Before starting, ensure:
Procedure
Step 1: Check Overall CI/CD Status
Purpose: Get a quick overview of all workflow runs
Commands:
gh run list --limit 10
gh run list --branch main --limit 10
gh run list --branch $(git branch --show-current) --limit 5
Validation:
- Output shows list of workflow runs with status (✓ completed, ✗ failed, * in_progress)
- Recent runs should show "completed" status
If step fails:
- Verify
gh CLI is authenticated: gh auth status
- Ensure you're in a git repository:
git status
- Check network connectivity
Step 2: View Details of Failed Runs
Purpose: Identify which specific jobs failed in a workflow run
Commands:
gh run view $(gh run list --status failure --limit 1 --json databaseId --jq '.[0].databaseId')
gh run view <RUN_ID>
gh run watch
Validation:
- Output shows which jobs passed/failed
- Failed jobs are clearly marked
- Run URL is displayed for browser viewing
If step fails:
- If no runs found, check:
gh run list --limit 20
- Run may have been deleted or archived
Step 3: View Logs for Failed Jobs
Purpose: Get detailed logs to understand why a job failed
Commands:
gh run view $(gh run list --status failure --limit 1 --json databaseId --jq '.[0].databaseId') --log
gh run view <RUN_ID> --log-failed
gh run download <RUN_ID> --dir ./ci-logs
Validation:
- Logs show error messages and stack traces
- You can identify the specific step that failed
- Error context is visible
If step fails:
- Logs may be too large for terminal display
- Use
--log > output.log to save to file
- Use GitHub web UI as fallback
Step 4: Check Specific Workflow Status
Purpose: Focus on a specific workflow (Test or Lint)
Commands:
gh run list --workflow=ci.yml --limit 10
gh run list --workflow=lint.yml --limit 10
gh run list --workflow=ci.yml --branch $(git branch --show-current)
gh run list --workflow=lint.yml --branch $(git branch --show-current)
Validation:
- Shows runs specific to the workflow
- Can identify if one workflow is consistently failing
- Can compare success rates between workflows
If step fails:
- Verify workflow file names:
ls .github/workflows/
- Workflow may not have run yet on current branch
Step 5: Re-run Failed Workflows
Purpose: Retry failed workflows after fixing issues or if failure was transient
Commands:
gh run rerun $(gh run list --status failure --limit 1 --json databaseId --jq '.[0].databaseId')
gh run rerun $(gh run list --status failure --limit 1 --json databaseId --jq '.[0].databaseId') --failed
gh run watch
Validation:
- Command confirms re-run started
- New run appears in
gh run list
- Can watch progress with
gh run watch
If step fails:
- May not have permissions to re-run
- Workflow may be too old (>30 days)
- Try from GitHub web UI
Validation
After completing all steps, verify:
-
Overall Health:
gh run list --limit 5
Expected result: Recent runs show ✓ (completed) status
-
Both Workflows Passing:
gh run list --workflow=ci.yml --status success --limit 1
gh run list --workflow=lint.yml --status success --limit 1
Expected result: Both workflows have recent successful runs
-
Current Branch Status:
gh run list --branch $(git branch --show-current)
Expected result: Latest runs on current branch are successful
Troubleshooting
Common Issues
Issue 1: Test Workflow Failing - Installation Tests
Symptoms:
- Test workflow shows failure
- Error in "Run test suite" step
- Message about installation failure
Resolution:
gh run view --log-failed
npm test
npm run build
npm test -- --reporter spec
Issue 2: ShellCheck Failures
Symptoms:
- Lint workflow fails at "ShellCheck" step
- Output shows shell script warnings/errors
- Specific scripts in
./scripts or ./test have issues
Resolution:
gh run view --log-failed | grep -A 5 "ShellCheck"
brew install shellcheck
shellcheck ./scripts/*.sh ./test/*.sh
Issue 3: Markdown Lint Failures
Symptoms:
- Lint workflow fails at "Markdown Lint" step
- Markdown formatting issues in
*.md files
Resolution:
gh run view --log-failed | grep -A 10 "Markdown Lint"
npm install
npx markdownlint-cli2 "**/*.md" "!node_modules"
Issue 4: Matrix Build Failures (Ubuntu vs macOS)
Symptoms:
- Test workflow fails on one OS but not the other
- Usually Ubuntu succeeds, macOS fails (or vice versa)
Resolution:
gh run view <RUN_ID> --log | grep -A 20 "Test on macos-latest"
gh run view <RUN_ID> --log | grep -A 20 "Test on ubuntu-latest"
npm test
npm run build
Issue 5: Workflow Not Running
Symptoms:
- No workflow runs appear for recent commits
- PR doesn't show CI/CD checks
Resolution:
cat .github/workflows/ci.yml | grep -A 5 "on:"
cat .github/workflows/lint.yml | grep -A 5 "on:"
gh run list --branch $(git branch --show-current) --limit 5
When to Escalate
Escalate if:
- Workflows consistently fail across all branches
- Infrastructure issues (GitHub Actions down)
- Permissions issues preventing access to logs
- Repeated transient failures
- Security scanning alerts
Escalation Contact:
Post-Procedure
After completion:
Quick Reference
Most Useful Commands
gh run list --limit 5
gh run view $(gh run list --status failure --limit 1 --json databaseId --jq '.[0].databaseId') --log-failed
gh run rerun $(gh run list --status failure --limit 1 --json databaseId --jq '.[0].databaseId') --failed
gh run watch
./test/test-install.sh
shellcheck ./scripts/*.sh ./test/*.sh
npx markdownlint-cli2 "**/*.md"
Notes
Important Notes:
- Always check logs before re-running - transient failures are rare
- Matrix builds can have OS-specific issues
- ShellCheck severity is set to "warning" - all warnings must be fixed
- Markdown linting is strict - follow conventions consistently
Gotchas:
- macOS test failures often relate to
/tmp vs /private/tmp paths
- Workflow runs older than 30 days cannot be re-run
- Log downloads create nested directories by job name
Related Procedures:
Revision History
| Date | Author | Changes |
|---|
| 2025-10-14 | @tnez | Initial creation |