agentleFS
glslangglslang/windbg-mcp/.claude/skills/merge-dependabot-prs/SKILL.md

merge-dependabot-prs

Skill21 starsChanged 11 days agoMITView on GitHub

Walk the open Dependabot PR queue oldest-first and merge each one once CI is green. Use when the user asks to "merge dependabot PRs", "clear the dependabot queue", "process bot updates", "ship the dep bumps", or similar. Fixes failing CI when possible (pushing to the bot's branch or opening a follow-up PR), and never blocks the queue on a single failure — skips and continues.

  • Installs packages
  • Commits and pushes

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 0 are common, 6 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    MCP: call mcp__github__list_pull_requests with state: "open".

    line 36
  2. Distinctive:

    If the list is empty, report so and stop.

    line 38
  3. Very specific:

    If mergeStateStatus is BEHIND or DIRTY, ask Dependabot to rebase rather than rebasing yourself — it handles its own lockfile regen:

    line 53
  4. Very specific:

    Wait ~60–120s, re-read state.

    line 58
  5. Very specific:

    If checks never start, comment @dependabot recreate and re-poll.

    line 67
  6. Very specific:

    Check repo merge settings once at start of run (gh repo view --json mergeCommitAllowed,squashMergeAllowed,rebaseMergeAllowed).

    line 71
  7. Distinctive:

    If push is rejected (branch protection, or the actor lacks write to bot branches), fall through to Path 2.

    line 108
  8. Distinctive:

    Create a new branch off the Dependabot branch:

    line 112
  9. Distinctive:

    After push, loop back to step 2c (wait for CI on the new commit).

    line 125
  10. Distinctive:

    If at any point this PR can't be merged and you've attempted one fix cycle, stop trying, log the reason, move to the next PR.

    line 129
  11. Distinctive:

    When the queue is exhausted, print:

    line 133
  12. Very specific:

    @dependabot rebase is async: After commenting, the bot takes 30s–2min to push.

    line 141
  13. Very specific:

    Closing a Dependabot PR tells the bot "don't try again.": If you close one that needs to come back, comment @dependabot recreate — not just …

    line 142
  14. Very specific:

    CI required checks vs. all checks: Only required checks block merge.

    line 147

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Merge Dependabot PRs

Process the open Dependabot PR queue oldest first. For each PR: bring it up to date with the base, wait for CI, merge if green. If CI fails, attempt an automated fix (push to the bot's branch if writable, otherwise open a follow-up PR). A single failing PR never stops the run — log the reason and move on.

0. Detect GitHub tooling (once, up front)

if command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1; then
  echo "USE: gh"
else
  echo "USE: mcp"
fi
  • gh available → use gh everywhere below.
  • Otherwise (Claude Code on the web, restricted environments) → use the mcp__github__* tools. Each step shows both.

Confirm the target repo (gh repo view / current git remote -v). If the user wants a different repo than cwd, ask.

1. List Dependabot PRs, oldest first

gh:

gh pr list \
  --author 'app/dependabot' \
  --state open \
  --json number,title,createdAt,headRefName,baseRefName,mergeable,mergeStateStatus \
  --jq 'sort_by(.createdAt)'

MCP: call mcp__github__list_pull_requests with state: "open". Filter results where user.login == "dependabot[bot]". Sort ascending by created_at.

If the list is empty, report so and stop.

Capture the ordered list of PR numbers — process them in that order, one at a time.

2. Inner loop: process one PR

For the current PR #N:

2a. Read state

  • gh: gh pr view N --json number,title,headRefName,baseRefName,mergeable,mergeStateStatus,statusCheckRollup,reviewDecision
  • MCP: mcp__github__pull_request_read (method: "get") + (method: "status") for checks.

2b. Rebase if behind / dirty

If mergeStateStatus is BEHIND or DIRTY, ask Dependabot to rebase rather than rebasing yourself — it handles its own lockfile regen:

  • gh: gh pr comment N --body "@dependabot rebase"
  • MCP: mcp__github__add_issue_comment with that body.

Wait ~60–120s, re-read state. If the bot doesn't act after two attempts, fall through to manual rebase (git fetch && git rebase origin/<base>) on the branch, or comment @dependabot recreate.

2c. Wait for CI

Poll statusCheckRollup until no check is IN_PROGRESS / PENDING / QUEUED. Cap at ~10 min per PR.

  • gh: gh pr checks N --watch (blocks until done) or loop on gh pr view N --json statusCheckRollup.
  • MCP: loop on mcp__github__pull_request_read with method: "status", sleep 15–30s between polls.

If checks never start, comment @dependabot recreate and re-poll.

2d. If green → merge

Check repo merge settings once at start of run (gh repo view --json mergeCommitAllowed,squashMergeAllowed,rebaseMergeAllowed). Prefer squash for Dependabot PRs when allowed (clean history: one bump = one commit).

  • gh: gh pr merge N --squash --delete-branch
  • MCP: mcp__github__merge_pull_request with the allowed merge_method.

Go back to step 2 for the next PR in the queue.

2e. If red → diagnose

  1. Pull failing logs.
    • gh: gh pr checks N → gh run view <run-id> --log-failed
    • MCP: read statusCheckRollup for each check's detailsUrl; WebFetch the run page or use mcp__github__get_commit for the SHA's checks.
  2. Classify (in order — stop at first match):

    Failure typeAction
    Flake / infra hiccup (network, runner crash)Re-run the failed job, don't push code. gh run rerun <run-id> --failed
    Lockfile / generated-file driftRun the project's regen command (e.g. npm install, bundle install, cargo update -p X, pnpm install --lockfile-only), commit, push.
    Snapshot / fixture mismatchRegenerate (jest -u, vitest --update, etc.), eyeball the diff for sanity, commit, push.
    Real code change (API rename, removed export, breaking type)Write the codemod / fix. Run tests locally if possible. Commit, push.
    Major-version bump with breaking changes you can't safely fix hereSkip. Comment a brief note on the PR explaining what's needed, move on.
    Repeated failure after one fix attemptSkip. Don't loop forever.

2f. Push the fix — branch path first, follow-up PR fallback

Path 1 — push to the Dependabot branch:

git fetch origin <headRefName>
git checkout <headRefName>
# apply fix
git add -A
git commit -m "fix: <what>"
git push origin <headRefName>

If push is rejected (branch protection, or the actor lacks write to bot branches), fall through to Path 2.

Path 2 — follow-up PR:

  1. Create a new branch off the Dependabot branch:
    git fetch origin <headRefName>
    git checkout -b followup/<N>-fix origin/<headRefName>
    # apply fix
    git commit -m "fix: <what> (carries #N)"
    git push -u origin followup/<N>-fix
  2. Open a PR targeting the same base as #N:
    • gh: gh pr create --base <baseRefName> --title "..." --body "Carries #N forward with required fixes."
    • MCP: mcp__github__create_pull_request with the same fields.
  3. Treat the follow-up PR as the new current PR in the loop. When it merges, the original Dependabot PR will auto-close (because its commits are now in base) — or close it explicitly with a note pointing at the follow-up.

After push, loop back to step 2c (wait for CI on the new commit).

2g. Never block the queue

If at any point this PR can't be merged and you've attempted one fix cycle, stop trying, log the reason, move to the next PR. Don't let one stuck bump strand the rest.

3. Final report

When the queue is exhausted, print:

  • Merged: #12, #15, #18, …
  • Skipped: #14 — major-version React bump; render snapshots need human review, #17 — repeated lint failure after two fix cycles
  • Open follow-ups: #22 (carries #16)

Gotchas

  • @dependabot rebase is async. After commenting, the bot takes 30s–2min to push. Don't trust the immediate post-comment state read; poll.
  • Closing a Dependabot PR tells the bot "don't try again." If you close one that needs to come back, comment @dependabot recreate — not just reopen.
  • Branch protection re-checks on every merge. A PR that was green an hour ago may show BLOCKED after an earlier merge in this same run (now behind). Always re-read state at step 2a, even if you already saw it green.
  • Grouped updates (dependabot.yml groups:): one PR may contain many bumps. If only one dep in the group breaks tests, consider @dependabot ignore <name> + recreate rather than fighting the failing test.
  • Don't use @dependabot merge. It bypasses any fixes you've pushed and gives you no record of which PRs this run touched. Do the merges yourself.
  • Secondary rate limits on long runs (30+ PRs). Back off 30s on any 403/429 from the API.
  • CI required checks vs. all checks. Only required checks block merge. An optional check failing is not a reason to skip — verify mergeable: MERGEABLE rather than reading "any check red = bad."
  • needs.* in workflows can leave a job permanently pending if a dependency was skipped. If a check is stuck QUEUED for >5min with no runner activity, it's probably a needs graph issue, not a slow runner — comment @dependabot recreate to get fresh check runs.

Inputs the user might give

  • "merge them all" → run the full procedure on every open Dependabot PR.
  • "just the patch bumps" → after listing, filter PR titles for ^Bump .* from X.Y.Z to X.Y.(Z+n) (no major/minor change) before looping.
  • "dry run" → run steps 1, 2a, 2c (status only). Don't merge. Print what would happen.
  • "just #N" → skip step 1, jump into step 2 for that one PR.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.