agentsclimarketplace

Github merge prs

Skill mtzanidakis/skills/skills/github/github-merge-prs

Personal collection of Claude Code skills for daily-use workflows

Install
npx -y skills add mtzanidakis/skills --skill github-merge-prs

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when the user wants to bulk-merge open GitHub pull requests on the current repo. Triggers include "merge open PRs", "merge the dependabot PRs", "clean up open PRs", "merge all PRs", "merge what's mergeable". Handles Dependabot conflicts by commenting `@dependabot rebase` (never closing the PR), polls for the rebased commit, and re-attempts the merge. Surfaces (does not bypass) failing checks or required reviews.

SKILL.md

2.9 KB, 664 tokens by cl100k_base, as published. Nobody here has run it

Merge Open PRs

Bulk-merge every open PR on the current GitHub repo via gh. PRs that conflict because of an earlier merge in this same run (typically package-lock.json after a Dependabot bump just landed) must be rebased, not closed.

Assume gh is authenticated and the working directory is a clone of the target repo. Detect the default branch on demand:

gh repo view --json defaultBranchRef -q .defaultBranchRef.name

Workflow

  1. List open PRs:

    gh pr list --state open --json number,title,author,mergeable,mergeStateStatus,headRefName
    
  2. Attempt to merge each PR in the order returned. Default to squash; respect a different strategy if the repo's settings or the user say so:

    gh pr merge <number> --squash --delete-branch
    
    • If mergeStateStatus: BLOCKED due to pending checks, pass --auto so it merges once green, or skip and revisit at the end of the pass — pick based on what the user wants and surface the choice if unclear.
    • If blocked by required reviews, surface to the user and skip — don't bypass.
  3. On merge conflict (mergeable: CONFLICTING):

    • Never close the PR.
    • If the author is dependabot[bot], trigger a rebase:
      gh pr comment <number> --body "@dependabot rebase"
      
      Track the PR as "awaiting rebase" and move on.
    • If the author is not Dependabot, skip and report — don't attempt automated resolution.
  4. Wait for Dependabot rebases. After the initial pass, poll the rebased PRs. Dependabot usually force-pushes a rebased commit within 1–3 minutes:

    gh pr view <number> --json mergeable,mergeStateStatus,headRefOid
    

    A new headRefOid plus mergeable: MERGEABLE means the rebase landed — retry the merge. Loop until every rebased PR is either merged or has clearly failed (Dependabot comments when it can't rebase — e.g. the PR was modified by a human, or the rebase itself conflicts). Cap total wait at ~10 minutes so the loop doesn't hang on a stuck PR. Surface failures and leave those PRs open.

  5. Sync local after all merges:

    git checkout "$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)"
    git pull --ff-only
    

Hard rules

  • Never gh pr close to "resolve" a conflict.
  • Never force-push to a PR branch you don't own.
  • Don't comment @dependabot rebase on a PR whose problem isn't a conflict (e.g. failing tests) — that just creates noise. Surface the real failure instead.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.