MergeGuard

Smart, policy-driven pull request automation for GitHub

MergeGuard is a GitHub pull request policy engine that evaluates pull request context and determines the exact approvals and checks required before merges.

MergeGuard adds a flexible policy layer on top of GitHub pull requests, enabling conditional approvals, context-aware required checks, and intelligent merge automation—all configured through a single YAML file in your repository.

Merge queue note: MergeGuard fits naturally before the final merge step. It evaluates the pull request as usual and, on merge-queue branches, also publishes a queue-compatible status check on the synthetic merge_group commit.



What MergeGuard Does

  • Conditional Approvals - Require different reviewers based on files changed, PR size, labels, and more
  • Context-Aware Checks - Only run expensive CI when needed, saving time and money
  • Auto-Approval & Auto-Merge - Automate trusted updates (e.g., Dependabot patches)
  • PR Dependencies - Enforce merge order for stacked or dependent PRs
  • Priority-Based Rules - Multiple rules can match; priority decides which applies
  • GitHub-Native - Works seamlessly with GitHub Checks, no external dependencies

Single PR Merge Readiness

MergeGuard provides clear visibility into merge readiness through GitHub Check Runs. Every pull request gets a dedicated check that shows:

  • ✅ Which rules matched and are being enforced
  • 📋 Required approvals and current status
  • 🔍 Required checks that must pass
  • 🚀 Whether auto-approval or auto-merge is configured
  • ⏸️ PR dependencies blocking merge (if any)

MergeGuard Check Run showing merge readiness

The check updates in real-time as approvals are added, checks complete, or PR content changes—giving your team instant feedback on what’s needed to merge.

On branches that use GitHub merge queue, the pull request check still explains the policy and blockers, while MergeGuard also reports a companion check for the queue’s temporary commit.


Example Configuration

rules:
  - name: "Small changes"
    if:
      maxLocChanged: 10
      excludePaths: ["infra/**"]
    require:
      approvals: 1
    action:
      autoApprove: true

  - name: "Infrastructure changes"
    if:
      paths: ["infra/**"]
    require:
      approvals: 2
      teams: ["platform-team"]
      checks:
        - "terraform-validate"
        - "security-scan"

Ready to Get Started?

Install MergeGuard on your GitHub repository and add a .github/mergeguard.yml file.

Need help? Check out the Quickstart Guide or browse the Features.