--- name: github-pr-merge which: gh disable-model-invocation: true description: "Validate, merge, and clean up a GitHub pull request. Use when asked to merge, accept, or integrate a GitHub PR." --- # GitHub PR Merge An explicit request to merge authorizes execution once every gate passes; do not ask for a second confirmation. `ok` alone is not a merge request. Process one PR by default and explicitly requested multiples sequentially. ## Gates 1. Refresh the target and head, then pin their commits. 2. Preserve intent from the original request, linked issue or specification, PR description, and final diff. Conflicting intent or unrelated additions require clarification. 3. Reinspect the complete final diff and verify every review finding and unresolved thread. Reply with evidence and resolve only addressed threads. 4. Run critical local checks and wait for required GitHub Actions checks. Repair straightforward failures, publish updates, rerun the complete readiness loop, and keep the title and body synchronized with final scope. Never publish repairs to a contributor's branch without permission. After two failed rounds, stop with evidence. 5. Require applicable human approval. Never approve the user's own PR. 6. Verify issue-closing references are appropriate and the PR fully resolves every issue it claims to close. 7. Never bypass protections, approvals, or required checks unless explicitly authorized for this exact merge and permitted by repository policy. 8. Immediately before merging, refresh again. New commits restart review and checks; changed scope requires confirmation. ## Merge and cleanup - Honor repository merge policy. Otherwise squash and use the polished PR title and body as the commit message. Avoid merge commits. - Never enable auto-merge unless requested. - Verify the merged commit is reachable from the target and the PR is closed. - Delete only the PR's remote and local branch, and remove only its isolated worktree or workspace. - Synchronize the target checkout without disturbing unrelated branches or work. - Monitor target checks and report failures. Do not revert or open follow-up changes without approval. Done means: merged commit verified on target, PR closed, scoped cleanup complete, and target status reported.