github-pr-merge-cleanup

Merge GitHub pull requests and clean up branches after validation.

Updated Dec 11, 2025
One-click install
npx skills add https://github.com/CareCard-ca/pkg-auth-util --skill github-pr-merge-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-pr-merge-cleanup
Source: https://github.com/CareCard-ca/pkg-auth-util/tree/main/.agents/skills/github-pr-merge-cleanup
Command: npx skills add https://github.com/CareCard-ca/pkg-auth-util --skill github-pr-merge-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reducing the risk and manual effort involved in merging a GitHub pull request by handling mergeability checks, conflict prevention, required validations, and post-merge cleanup.

Core Features & Use Cases

  • Mergeability validation and conflict detection: Verifies merge state and detects merge conflicts before altering history.
  • Conditional rebase for conflict recovery: Rebases the target branch onto the fresh base when conflicts are detected, aborting if rebase fails.
  • Protected-branch-aware merge and cleanup: Merges with GitHub CLI, optionally deletes the remote branch only when it is not protected, and cleans local state afterward.

Quick Start

Ask the AI to merge your open GitHub pull request (from your current target branch) into origin/development only if the user explicitly requested remote PR merge and cleanup work.

Frequently Asked Questions about github-pr-merge-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely merge a GitHub pull request and clean up the branch afterward?

Safely merging a GitHub pull request requires verifying mergeability, detecting conflicts using merge-tree, executing PR checks, merging with GitHub CLI, and deleting the remote branch only when it is not protected.

What happens when merge conflicts are detected during a pull request merge?

When merge conflicts are detected during a pull request merge, the workflow attempts a conditional rebase onto the fresh base branch and aborts the process safely if the rebase fails, preventing broken history.

Do I need GitHub CLI authentication to automate pull request merging and cleanup?

Yes, GitHub CLI authentication is required to automate pull request merging and cleanup, because the workflow relies on it to execute protected-branch-aware merges and perform remote branch deletion.

Can I automate branch cleanup for protected branches after a PR merge?

You cannot automate remote branch cleanup for protected branches after a PR merge, because the workflow is protected-branch-aware and only deletes the remote branch when it is explicitly not protected.

What's the best way to prevent broken history when merging a PR with conflicts?

The best way to prevent broken history when merging a PR with conflicts is to use merge-tree conflict detection before altering anything, then apply a conditional rebase and abort if the rebase fails.