Monitor a PR and auto-merge when all checks pass
This skill monitors a GitHub Pull Request and automatically merges it when all checks pass and it becomes mergeable.
/merge-pr-when-ready <pr-number>
/merge-pr-when-ready 326
This skill uses the Haiku model for cost-efficient monitoring since it's a simple polling task that doesn't require complex reasoning.
Uses GitHub MCP tools when available for API access, falls back to gh CLI.
Extract PR number from arguments. If no argument provided, ask user for PR number.
Fetch PR details using GitHub MCP:
# Use mcp__github__pull_request_read with method="get"
mcp__github__pull_request_read(
method="get",
owner="whale-net",
repo="everything",
pullNumber=326
)
Display summary:
Monitoring PR #326: "Fix database migrations"
- Current State: OPEN
- Mergeable: MERGEABLE
- Merge State: BLOCKED (checks pending)
- Checks: 3 in progress, 0 failed
Use AskUserQuestion to confirm:
Question: "Start monitoring this PR for auto-merge?"
Header: "Confirm"
Options:
- "Yes, monitor and auto-merge when ready (Recommended)" - Start monitoring
- "No, cancel" - Exit without monitoring
Run the monitoring script from the skill directory:
# Path to the monitoring script (part of this skill)
SCRIPT_PATH="/home/alex/whale_net/everything/.claude/skills/merge-pr-when-ready/monitor-pr.sh"
# Execute the script with PR number
"${SCRIPT_PATH}" 326
The script (monitor-pr.sh) handles:
IMPORTANT:
gh CLI for reliability (GitHub MCP may not have merge permissions)When merge completes successfully, the script outputs:
✅ PR merged successfully!
🗑️ Branch deleted
**Summary:**
- Title: Fix database migrations
- Monitoring started: 2026-02-07 22:10:15
- Merged: 2026-02-07 22:15:30
- Total time: 5m 15s
The script handles:
SKILL.md - This documentationmonitor-pr.sh - Monitoring and merge script