| name | github-issue-resolver |
| description | Strategically resolves GitHub Actions failures, failed pull requests, and Dependabot issues using the gh CLI. Use when managing CI/CD failures, PR check failures, merge conflicts, or automated dependency updates. Triggers on mentions of failed workflows, broken builds, failing tests, Dependabot PRs, or GitHub Actions issues. |
| allowed-tools | Bash, Read, Edit, Write, Grep, Glob |
GitHub Issue Resolver
Automates GitHub repository maintenance by diagnosing and fixing GitHub Actions failures, managing failed pull requests, and strategically handling Dependabot updates using the GitHub CLI.
Prerequisites
Before using this skill, verify:
gh auth status
gh repo view
git rev-parse --git-dir
Required permissions: Write access to the repository (for pushing fixes, merging PRs, re-running workflows)
Required tools:
- GitHub CLI (
gh) version 2.0+
- Git CLI
- Appropriate language toolchains for the repository (npm, python, etc.)
When to Use This Skill
Activate this skill when you need to:
- Fix failing GitHub Actions workflows - "diagnose the failed CI build", "fix the failing tests in Actions"
- Resolve PR check failures - "fix the failing PR checks", "resolve conflicts in PR #123"
- Handle Dependabot updates - "merge safe Dependabot PRs", "resolve Dependabot conflicts"
- Triage multiple failures - "fix all failing workflows", "clean up failed PRs"
- Generate maintenance reports - "show me all failing checks", "summarize GitHub issues"
Core Workflows
1. GitHub Actions Failure Resolution
Objective: Identify failed workflow runs, analyze logs, diagnose root causes, implement fixes, and verify resolution.
Step 1: List Failed Workflows
gh run list --status failure --limit 20
gh run list --workflow "CI" --status failure --limit 10
gh run list --branch main --status failure
Output analysis: Note the Run ID, workflow name, branch, and when it failed.
Step 2: Retrieve Failure Logs
gh run view <run-id>
gh run view <run-id> --log-failed
gh run view <run-id> --log
Log analysis checklist:
Step 3: Diagnose Root Cause
Common failure patterns and diagnostic approaches:
Test Failures:
Build Errors:
Linting Issues:
Dependency Problems:
Environment Issues:
Step 4: Implement Fix
Based on diagnosis, implement the appropriate fix:
npm install
npm audit fix
pip install -r requirements.txt
npm run lint:fix
black .
Step 5: Commit and Push Fix
git add .
git commit -m "fix: resolve <failure-type> in <workflow-name>
- <specific fix description>
- Addresses run #<run-id>"
git push origin <branch-name>
Step 6: Verify Resolution
gh run watch
gh run rerun <run-id>
gh run view <run-id> --watch
gh run list --workflow "<workflow-name>" --limit 5
Success criteria: Workflow status changes to "completed" with conclusion "success"
2. Failed Pull Request Management
Objective: Identify PRs with failing checks, diagnose issues, implement fixes, and get PRs back to mergeable state.
Step 1: List PRs with Failed Checks
gh pr list --state open
gh pr checks <pr-number>
gh pr status
gh pr list --author "app/dependabot"
Step 2: Analyze PR Failures
gh pr view <pr-number>
gh pr checks <pr-number> --watch
gh pr diff <pr-number>
Failure categories:
- Failed CI checks → Follow GitHub Actions resolution workflow
- Merge conflicts → Resolve conflicts (see below)
- Failed required reviews → Address review comments
- Branch out of date → Update with base branch
Step 3: Checkout PR Branch
gh pr checkout <pr-number>
git branch --show-current
git log --oneline origin/main..HEAD
Step 4: Resolve Issues
For merge conflicts:
gh pr update-branch <pr-number>
git fetch origin
git merge origin/main
git add .
git commit -m "fix: resolve merge conflicts with main"
git push
For failed checks:
npm test
npm run build
npm run lint
git add .
git commit -m "fix: address PR check failures"
git push
For review comments:
gh pr view <pr-number> --comments
git add .
git commit -m "fix: address review comments"
git push
gh pr review <pr-number> --request-review
Step 5: Add PR Comment
Document what was fixed:
gh pr comment <pr-number> --body "### Fixes Applied
- ✅ Resolved merge conflicts with main
- ✅ Fixed failing test in \`test/feature.test.js\`
- ✅ Updated dependencies to resolve build error
All checks now passing. Ready for review."
Step 6: Verify PR Status
gh pr checks <pr-number>
gh pr view <pr-number>
3. Dependabot Issue Handling
Objective: Efficiently manage automated dependency updates with strategic merging, conflict resolution, and security prioritization.
Step 1: List Dependabot PRs
gh pr list --author "app/dependabot" --state open
gh pr list --author "app/dependabot" --json number,title,headRefName,statusCheckRollup
for pr in $(gh pr list --author "app/dependabot" --json number -q '.[].number'); do
echo "PR #$pr:"
gh pr checks $pr
done
Step 2: Categorize Updates
Group Dependabot PRs by type and risk:
Patch updates (1.2.3 → 1.2.4): Low risk, usually safe to batch merge
Minor updates (1.2.3 → 1.3.0): Medium risk, review changelog
Major updates (1.2.3 → 2.0.0): High risk, potential breaking changes
Security updates: High priority regardless of version change
gh pr view <pr-number>
gh pr list --author "app/dependabot" --label "security"
Step 3: Evaluate Breaking Changes
For each PR, especially major/minor updates:
gh pr view <pr-number>
gh release list --repo <dependency-repo>
Decision criteria:
- Auto-merge candidates: Patch updates with passing checks, no conflicts
- Manual review needed: Major updates, failed checks, security updates
- Batch merge candidates: Multiple patch updates to unrelated dependencies
Step 4: Resolve Dependabot PR Conflicts
gh pr checkout <pr-number>
gh pr comment <pr-number> --body "@dependabot rebase"
sleep 30
gh pr checks <pr-number>
git fetch origin
git rebase origin/main
git add .
git rebase --continue
git push --force-with-lease
Step 5: Handle Failed Dependabot Checks
gh pr checks <pr-number>
gh run view <run-id> --log-failed
For incompatibility issues:
gh pr checkout <pr-number>
gh pr view <pr-number>
npm test
git add .
git commit -m "fix: update code for <package>@<version> compatibility"
git push
Step 6: Strategic Merging
Security updates (highest priority):
gh pr checks <pr-number>
gh pr merge <pr-number> --auto --merge
Batch safe patch updates:
gh pr checks <pr-number> && gh pr merge <pr-number> --auto --squash
gh pr comment <pr-number> --body "@dependabot merge"
Major updates (careful review):
gh pr checks <pr-number>
gh pr diff <pr-number>
gh pr merge <pr-number> --merge
4. Strategic Prioritization & Triage
Objective: Systematically process multiple failures with appropriate prioritization.
Priority Levels
-
🔴 Critical (P0) - Handle immediately
- Security vulnerabilities
- Production build failures
- Main branch workflow failures
-
🟡 High (P1) - Handle within hours
- Failed PR checks blocking merges
- Breaking test failures
- Dependabot security updates
-
🟢 Medium (P2) - Handle within days
- Dependabot minor/major updates
- Non-blocking linting failures
- Documentation build failures
-
⚪ Low (P3) - Handle when convenient
- Dependabot patch updates (passing)
- Optional workflow failures
- Deprecated warnings
Triage Workflow
echo "=== Failed Workflows ==="
gh run list --status failure --limit 10
echo "=== Failed PR Checks ==="
for pr in $(gh pr list --json number -q '.[].number'); do
echo "Checking PR #$pr"
gh pr checks $pr | grep -i "fail" && echo "PR #$pr has failures"
done
echo "=== Dependabot PRs ==="
gh pr list --author "app/dependabot"
Systematic Processing
gh run list --status failure --workflow "Production Deploy" --limit 5
gh pr list --author "app/dependabot" --label "security"
gh pr list --search "is:open status:failure"
gh pr list --author "app/dependabot" --search "is:open status:success"
Generate Summary Report
cat > GITHUB_MAINTENANCE_REPORT.md << 'EOF'
**Date**: $(date +%Y-%m-%d)
**Repository**: $(gh repo view --json nameWithOwner -q .nameWithOwner)
- [ ] Fixed production workflow failure (run
- [ ] Merged security update for package X
- [ ] Fixed failing tests in PR
- [ ] Resolved merge conflicts in PR
- [ ] Merged 5 patch updates
- [ ] Updated major version of library Y (breaking changes addressed)
- PR
- Workflow "Performance Tests" - Intermittent failures, needs investigation
- PR
- Workflows fixed: 3
- PRs unblocked: 4
- Dependabot PRs merged: 8
- Total issues resolved: 15
EOF
Command Reference
Essential gh CLI Commands
Workflow Management:
gh run list [--status STATUS] [--workflow NAME] [--limit N]
gh run view <run-id> [--log] [--log-failed] [--web]
gh run watch [<run-id>]
gh run rerun <run-id> [--failed]
gh run download <run-id>
gh workflow list
gh workflow view <workflow-name>
gh workflow run <workflow-name>
Pull Request Management:
gh pr list [--state STATE] [--author USER] [--label LABEL]
gh pr view <pr-number> [--web] [--comments]
gh pr checkout <pr-number>
gh pr checks <pr-number> [--watch]
gh pr diff <pr-number>
gh pr update-branch <pr-number>
gh pr comment <pr-number> --body "MESSAGE"
gh pr review <pr-number> [--approve|--request-changes|--comment]
gh pr merge <pr-number> [--merge|--squash|--rebase] [--auto]
gh pr status
Issue Management:
gh issue list [--state STATE] [--label LABEL]
gh issue view <issue-number>
gh issue comment <issue-number> --body "MESSAGE"
gh issue close <issue-number>
gh issue create --title "TITLE" --body "BODY"
Repository Operations:
gh repo view [--web]
gh api <endpoint>
Common Flags and Options
--limit N - Limit results to N items
--json FIELDS - Output as JSON with specific fields
-q QUERY - JQ query for JSON output
--web - Open in web browser
--watch - Monitor for changes
--state [open|closed|merged|all] - Filter by state
Output Parsing Patterns
gh pr list --json number -q '.[].number'
gh run list --status failure --json databaseId -q '.[].databaseId'
gh pr list --json number,title,statusCheckRollup \
-q '.[] | select(.statusCheckRollup[].status=="FAILURE")'
gh pr list --author "app/dependabot" --json number -q '. | length'
Decision Trees
Workflow Failure Diagnosis
Failed Workflow Run
│
├─ Build Failure?
│ ├─ YES → Check compilation errors
│ │ ├─ TypeScript errors? → Fix type issues, update tsconfig
│ │ ├─ Missing dependencies? → npm install, update lockfile
│ │ └─ Build config issue? → Check webpack/vite/etc config
│ └─ NO → Continue
│
├─ Test Failure?
│ ├─ YES → Identify failing tests
│ │ ├─ Assertion failures? → Fix logic, update tests
│ │ ├─ Timeout? → Increase timeout, optimize code
│ │ └─ Flaky tests? → Add retries, fix race conditions
│ └─ NO → Continue
│
├─ Linting Failure?
│ ├─ YES → Run linter locally
│ │ ├─ Auto-fixable? → Run lint:fix
│ │ └─ Manual fix needed? → Edit files per linter output
│ └─ NO → Continue
│
├─ Dependency Installation Failure?
│ ├─ YES → Check package manager logs
│ │ ├─ Version conflict? → Update dependencies
│ │ ├─ Network issue? → Retry, check registry
│ │ └─ Missing package? → Add to dependencies
│ └─ NO → Continue
│
└─ Environment Issue?
├─ YES → Check workflow YAML
│ ├─ Missing step? → Add required step
│ ├─ Wrong environment? → Update actions/setup-* versions
│ └─ Permission issue? → Update workflow permissions
└─ NO → Escalate to manual investigation
Dependabot Merge Strategy
Dependabot PR
│
├─ Security Update?
│ ├─ YES → Priority: CRITICAL
│ │ ├─ Checks pass? → Merge immediately
│ │ └─ Checks fail? → Fix and merge ASAP
│ └─ NO → Continue
│
├─ Version Change Type?
│ ├─ PATCH (x.y.Z) → Priority: LOW
│ │ ├─ Checks pass? → Batch merge
│ │ ├─ Conflicts? → @dependabot rebase → merge
│ │ └─ Checks fail? → Investigate, fix if simple
│ │
│ ├─ MINOR (x.Y.0) → Priority: MEDIUM
│ │ ├─ Review changelog → Breaking changes?
│ │ │ ├─ NO → Treat as patch
│ │ │ └─ YES → Treat as major
│ │ └─ Checks fail? → Must fix before merge
│ │
│ └─ MAJOR (X.0.0) → Priority: HIGH (careful review)
│ ├─ Review migration guide
│ ├─ Check for breaking API changes
│ ├─ Update code for compatibility
│ ├─ Ensure all tests pass
│ └─ Merge only after thorough verification
│
└─ Special Cases
├─ Multiple updates to same package? → Take latest
├─ Conflicting updates? → Resolve dependencies first
└─ Deprecated package? → Consider alternatives
PR Check Failure Resolution
PR with Failed Checks
│
├─ What failed?
│ ├─ CI Workflow → Follow "Workflow Failure Diagnosis" tree
│ ├─ Required Review → Wait for reviewer or address comments
│ └─ Branch Protection → Check protection rules
│
├─ Merge Conflicts?
│ ├─ YES → Resolution path
│ │ ├─ gh pr update-branch (automatic)
│ │ └─ Manual merge if automatic fails
│ └─ NO → Continue
│
├─ Branch Out of Date?
│ ├─ YES → gh pr update-branch
│ └─ NO → Continue
│
└─ After fixes applied
├─ All checks pass? → Ready to merge
├─ Some checks still fail? → Iterate
└─ Blocked by external factor? → Document and wait
Safety Guidelines
Actions Requiring Confirmation
ALWAYS ask before:
- Merging to protected branches (main, production, etc.)
- Force-pushing to any branch
- Deleting branches
- Closing issues or PRs
- Running destructive workflow operations
- Batch merging more than 5 PRs
Example confirmation request:
I've fixed the failing tests and all checks now pass.
Ready to merge PR #123 to main. Should I proceed with the merge?
Rollback Procedures
If a fix makes things worse:
git log --oneline -5
git revert <commit-hash>
git push origin <branch-name>
git checkout -b hotfix/revert-broken-change
git revert <commit-hash>
git push origin hotfix/revert-broken-change
gh pr create --title "Hotfix: Revert broken change" \
--body "Reverts commit <hash> which caused <issue>"
What NOT to Automate
Never automatically:
- Merge PRs without check verification
- Ignore security warnings
- Disable required checks
- Skip code review requirements
- Force-push to protected branches
- Modify workflow permissions without review
- Approve your own PRs
- Merge major version updates without testing
Defensive Practices
gh pr checks <pr-number>
git status
git diff
git checkout -b fix/issue-name
git add .
git stash
gh pr comment <pr-number> --body "Detailed explanation"
git commit -m "Detailed message"
Examples
Example 1: Fix Failed CI Workflow
Scenario: Main branch CI workflow fails with test errors.
$ gh run list --status failure --limit 5
STATUS NAME BRANCH EVENT ID
X CI main push 12345678
$ gh run view 12345678 --log-failed
$
$
$ git add src/utils.js
$ git commit -m "fix: add null check in utils.js map operation
- Prevents TypeError when data is undefined
- Addresses CI failure in run #12345678"
$ git push origin main
$ gh run watch
✓ CI completed successfully
Example 2: Resolve PR with Failed Checks and Conflicts
Scenario: PR #89 has failing tests and merge conflicts.
$ gh pr view 89
Status: Some checks failing, conflicts with base branch
$ gh pr checks 89
X CI - Tests Failed
X Merge conflict
$ gh pr checkout 89
Switched to branch 'feature/auth'
$ gh pr update-branch 89
$ git fetch origin
$ git merge origin/main
$ git add src/auth.js
$ git commit -m "fix: resolve merge conflicts with main"
$ npm test
$ npm test
$ git add .
$ git commit -m "fix: update auth tests for new API structure"
$ git push
$ gh pr checks 89
✓ All checks passing
$ gh pr comment 89 --body "### Fixes Applied
✅ Resolved merge conflicts with main
✅ Fixed failing auth tests (updated for new API structure)
All checks now passing. Ready for review."
Example 3: Strategic Dependabot Management
Scenario: 15 Dependabot PRs pending, mix of security, patch, and major updates.
$ gh pr list --author "app/dependabot"
... (11 more)
$ gh pr list --author "app/dependabot" --label "security"
$ gh pr checks 95
✓ All checks passing
$ gh pr merge 95 --squash
✓ Merged
$ for pr in 94 96 98 100 102; do
echo "Checking PR #$pr"
if gh pr checks $pr | grep -q "✓"; then
gh pr merge $pr --squash
echo "Merged PR #$pr"
fi
done
$ gh pr view 92
$ gh pr checkout 92
$ npm test
$ npm test
$ git add .
$ git commit -m "fix: update React APIs for v18 compatibility"
$ git push
$ gh pr checks 92
✓ All checks passing
$ gh pr comment 92 --body "@dependabot merge"
Example 4: Triage Multiple Failures
Scenario: Monday morning - multiple failures accumulated over weekend.
$ echo "=== Workflow Failures ==="
$ gh run list --status failure --limit 10
$ echo "=== PR Check Failures ==="
$ for pr in $(gh pr list --json number -q '.[].number'); do
if gh pr checks $pr | grep -q "X"; then
echo "PR #$pr has failures"
fi
done
$ echo "=== Dependabot ==="
$ gh pr list --author "app/dependabot" | wc -l
$ gh run view <deploy-run-id> --log-failed
$ gh run view <ci-run-id> --log-failed
$ gh pr list --author "app/dependabot" --label "security"
$ cat > TRIAGE_REPORT_$(date +%Y%m%d).md << 'EOF'
- Total issues identified: 18
- Critical issues resolved: 1 (deploy failure)
- Workflows fixed: 2
- PRs unblocked: 3
- Dependabot PRs merged: 10
- Pending manual review: 2
EOF
Error Handling
Common Failure Modes
1. Authentication Issues
Error: authentication required
Recovery:
gh auth login
gh auth status
2. Permission Denied
Error: Resource not accessible by integration
Recovery: Verify you have write access to the repository. Contact repository admin if needed.
3. Rate Limiting
Error: API rate limit exceeded
Recovery: Wait for rate limit reset or authenticate with a different token.
gh auth status
4. Merge Conflicts Too Complex
Error: Automatic merge failed
Recovery: Manual intervention required.
echo "Merge conflicts require manual review:"
git status
5. Failed Checks Cannot Be Fixed Automatically
Recovery: Document findings and escalate.
gh pr comment <pr-number> --body "## Automated Fix Attempted
Unable to automatically resolve check failures.
### Diagnosis
- [Finding 1]
- [Finding 2]
### Recommended Actions
- [ ] Manual review of [specific area]
- [ ] Consider [alternative approach]
cc @maintainer"
Recovery Strategies
Strategy 1: Incremental Fixes
- Fix one issue at a time
- Verify after each fix
- Rollback if new issues emerge
Strategy 2: Safe Rollback
git log --oneline -5
git revert <hash>
git push
Strategy 3: Create Issue for Complex Problems
gh issue create --title "Automated fix failed for workflow X" \
--body "## Context
Attempted to fix workflow failure but encountered:
[detailed description]
## Logs
\`\`\`
[relevant logs]
\`\`\`
## Next Steps
- [ ] Manual investigation needed
- [ ] Possible root cause: [hypothesis]"
When to Abort and Alert
Abort immediately if:
- Fixes would require force-pushing to protected branches
- Changes would affect critical production code without tests
- Root cause cannot be diagnosed from available information
- Fix requires architectural decisions beyond code changes
- Security implications are unclear
Alert maintainers when:
- Multiple fix attempts fail
- Issues indicate deeper architectural problems
- Security vulnerabilities are discovered
- Breaking changes affect multiple systems
Escalation template:
gh issue create --title "🚨 Automated resolution failed: [Issue]" \
--label "needs-attention" \
--body "## Automated Resolution Attempted
**Issue**: [Description]
**Severity**: [Critical/High/Medium]
**Workflow/PR**: [Link]
## What Was Tried
1. [Action 1] - Result: [Outcome]
2. [Action 2] - Result: [Outcome]
## Current State
- [Status of system]
- [Blockers identified]
## Recommendation
Manual intervention required for:
- [ ] [Specific task]
- [ ] [Specific task]
## Additional Context
[Logs, stack traces, relevant info]"
Best Practices
- Verify Before Acting: Always check current state before making changes
- Document Everything: Use descriptive commits and PR comments
- Test Locally: Run tests and builds locally before pushing when possible
- Incremental Changes: Make small, focused commits rather than large batch changes
- Monitor Results: Watch workflow runs and PR checks after changes
- Communicate Clearly: Explain what was fixed and why in PR comments
- Know Your Limits: Escalate complex issues rather than forcing fixes
- Maintain Audit Trail: Keep detailed logs of automated actions
- Security First: Prioritize security updates over feature updates
- Respect Review Process: Don't bypass code review requirements
Quick Reference Card
gh run list --status failure --limit 10
gh pr list --search "is:open status:failure"
gh pr list --author "app/dependabot"
gh run view <run-id> --log-failed
gh pr checks <pr-number>
gh pr view <pr-number>
gh pr checkout <pr-number>
gh pr update-branch <pr-number>
git add . && git commit -m "fix: description"
git push
gh run watch
gh pr checks <pr-number>
gh pr merge <pr-number> --squash
git revert <hash> && git push
gh issue create --title "Alert" --label "urgent"
Conclusion
This skill enables systematic, safe, and efficient GitHub repository maintenance. Always prioritize safety over speed, document all actions, and escalate when uncertain. The goal is to reduce toil while maintaining code quality and security standards.