merge-pr
1
总安装量
1
周安装量
#49706
全站排名
安装命令
npx skills add https://github.com/squirrel289/pax --skill merge-pr
Agent 安装分布
github-copilot
1
Skill 文档
Merge PR
A workflow skill that safely merges pull requests after comprehensive verification of readiness.
Purpose
Automates the PR merge process with proper safety checks, ensuring all requirements are met before merging.
When to Use
Use this workflow when:
- PR is ready to be merged to main branch
- You want automated verification before merge
- Need to ensure all checks pass
- Want consistent merge process across team
Skill Composition
This workflow composes:
- pull-request-tool: Check PR status, verify checks, execute merge
- sequential-execution: Step through verification stages
- yolo OR collaborative: Execution mode (autonomous vs interactive)
Parameters
Required
- pr-number: Pull request number to merge
- repository: Repository in format
owner/repo
Optional
- interaction-mode:
yolo(autonomous) orcollaborative(ask before merge) - merge-method:
merge(default),squash, orrebase - delete-branch: Delete branch after merge (default: true)
- auto-merge: Enable auto-merge if checks pending (default: false)
- require-reviews: Minimum required approvals (default: 1)
- require-checks: Require all status checks pass (default: true)
Workflow Steps
Phase 1: Pre-Merge Verification
-
Fetch PR details
- Get PR metadata
- Verify PR is open
- Check base and head branches
-
Verify approvals
- Check review status
- Count approvals
- Verify required approvals met
- Check for blocking reviews
-
Check status
- Verify mergeable state
- Check for merge conflicts
- Verify branch is up to date
-
Verify CI checks
- List all status checks
- Verify required checks pass
- Check for failing checks
- Ensure no pending required checks
-
Check review threads
- Verify no unresolved threads (or policy allows)
- Check for blocking comments
Phase 2: Merge Decision
-
Determine merge readiness
PR is ready to merge if:
- â Mergeable state is CLEAN or UNSTABLE (no conflicts)
- â Required approvals received
- â All required status checks pass
- â No blocking review comments
- â Branch protection rules satisfied
-
Select merge method
- Use specified merge-method parameter
- Or infer from repo settings/history
- Default to squash if uncertain
Phase 3: Execution
-
Execute merge (if ready)
YOLO mode:
- Merge immediately if all checks pass
- Report success or failure
Collaborative mode:
- Show merge summary
- Request confirmation
- Execute after approval
-
Post-merge cleanup
- Delete branch if requested
- Verify merge succeeded
- Check main branch updated
Phase 4: Finalization
-
Verify completion
- Confirm PR status is merged
- Verify commit appears in main
- Check branch deleted if requested
-
Report results
- Summarize merge operation
- Report any issues
- Provide next steps if needed
Interaction Modes
YOLO Mode (Autonomous)
When interaction-mode = yolo:
- Automatically merge if all checks pass
- Use default merge method (or specified)
- Delete branch automatically
- Report only final status
Example:
User: "Merge PR #42 in YOLO mode"
Agent:
- Verifies all checks pass
- Verifies approvals present
- Merges using squash (repo default)
- Deletes feature branch
- Reports: "PR #42 merged successfully to main, branch deleted"
Collaborative Mode (Interactive)
When interaction-mode = collaborative:
- Show merge readiness status
- Display all checks and approvals
- Request confirmation before merging
- Confirm branch deletion
Example:
User: "Merge PR #42"
Agent: "Checking merge readiness for PR #42...
PR Status:
â
Mergeable: Yes (no conflicts)
â
Reviews: 2 approvals (reviewer1, reviewer2)
â
Status Checks: All passing (8/8)
â
CI Tests
â
Linter
â
Security Scan
â
Build
â
Integration Tests (x4)
â
Branch Protection: Satisfied
â
Unresolved Threads: 0
Ready to merge using squash method.
Delete branch 'feature-xyz' after merge? (yes/no)"
User: "yes"
Agent: "Merging PR #42..."
[executes merge]
"â
PR #42 merged successfully and branch deleted"
Merge Methods
Merge Commit (–merge)
- Creates merge commit
- Preserves full history
- Use when: History context important
Squash and Merge (–squash)
- Combines all commits into one
- Clean linear history
- Use when: Feature commits not important
Rebase and Merge (–rebase)
- Replays commits on base
- Linear history, preserves commits
- Use when: Clean history with commit granularity
Auto-Merge Option
When auto-merge = true:
- Enables GitHub auto-merge feature
- PR will merge automatically when checks pass
- Useful for:
- PRs with pending checks
- Dependabot updates
- Automated workflows
Verification Checklist
Before merging, verify:
- PR is open (not closed/merged already)
- No merge conflicts
- Required approvals received
- All required status checks pass
- No blocking review comments
- Branch protection rules satisfied
- Correct base branch (usually main)
- Changes reviewed and acceptable
Error Handling
Common Issues and Resolutions
-
Merge conflicts
- YOLO: Report blocker, cannot proceed
- Collaborative: Suggest rebasing or conflict resolution
- Manual intervention required
-
Failing status checks
- YOLO: Wait or report blocker
- Collaborative: Show failing checks, ask to wait or investigate
- Auto-merge option: Enable auto-merge to merge when passes
-
Missing approvals
- YOLO: Report blocker, request reviews
- Collaborative: Show who can approve, ask to request
- Cannot proceed without required approvals
-
Unresolved threads
- YOLO: Attempt to resolve if trivial, otherwise report
- Collaborative: Show threads, ask to resolve
- Policy-dependent: Some repos allow merging with unresolved
-
Branch protection violations
- Report specific requirement not met
- Cannot override (requires admin)
- Must satisfy all rules
Best Practices
- Always verify checks: Never merge with failing tests
- Respect approvals: Ensure required reviews complete
- Clean up branches: Delete after merge to reduce clutter
- Use appropriate method: Match repo conventions
- Verify conflicts: Check mergeable state first
- Update main locally: Pull after merging
- Notify team: Communication for significant merges
- Tag releases: Create tags for versioned merges
Safety Guards
Even in YOLO mode, never:
- â Merge with failing required checks
- â Merge without required approvals
- â Merge with conflicts
- â Override branch protection
- â Skip verification steps
Always:
- â Verify PR is ready
- â Check all status checks
- â Confirm approvals present
- â Use safe merge method
- â Report any issues
Output Format
YOLO Mode Output
TASK: Merge PR #42
STATUS: Success
VERIFICATION:
â
Approvals: 2/1 required
â
Status Checks: 8/8 passing
â
Merge Conflicts: None
â
Branch Protection: Satisfied
MERGE:
Method: Squash and merge
Commit: abc1234
Branch: feature-xyz (deleted)
RESULT: PR #42 successfully merged to main
Collaborative Mode Output
PR Merge Readiness (#42)
Status Checks:
â
CI Tests (3m 24s)
â
Linter (45s)
â
Security Scan (1m 12s)
â Integration Tests (failed)
Current Status: NOT READY
Blocker: Integration tests failing
Recommended action: Fix test failures or investigate
Would you like me to:
A) Show test failure details
B) Wait for checks to be fixed and retry
C) Cancel merge operation
Integration Example
# Full PR workflow using composed skills
1. process-pr (parent workflow)
2. resolve-pr-comments
- Address all feedback
3. merge-pr (this workflow)
- Verify readiness
- Execute merge
Done: PR fully processed and merged
Quick Reference
PURPOSE:
Safely merge PR after comprehensive verification
COMPOSITION:
pull-request-tool + sequential-execution + (yolo OR collaborative)
MODES:
YOLO: Auto-merge if ready
Collaborative: Confirm before merge
PHASES:
1. Pre-Merge Verification
2. Merge Decision
3. Execution
4. Finalization
VERIFICATION:
- Mergeable state
- Required approvals
- Status checks
- No conflicts
- Branch protection
MERGE METHODS:
merge: Merge commit (preserves history)
squash: Single commit (clean history)
rebase: Linear history (preserves commits)
PARAMETERS:
pr-number: Required
repository: Required (owner/repo)
interaction-mode: yolo or collaborative
merge-method: merge/squash/rebase
delete-branch: true (default)
auto-merge: false (default)
SAFETY:
Never merge with:
- Failing required checks
- Missing approvals
- Merge conflicts
- Branch protection violations