Skip to content

v1.1.0 — dependabot-keep-current reusable (auto-rebase blocked Dependabot PRs) - #6

Merged
mcarter-astronautdev merged 1 commit into
mainfrom
feat/dependabot-keep-current
Jun 17, 2026
Merged

v1.1.0 — dependabot-keep-current reusable (auto-rebase blocked Dependabot PRs)#6
mcarter-astronautdev merged 1 commit into
mainfrom
feat/dependabot-keep-current

Conversation

@mcarter-astronautdev

@mcarter-astronautdev mcarter-astronautdev commented Jun 17, 2026

Copy link
Copy Markdown
Member

Adds a mechanical reusable that retires the manual @dependabot rebase: when a PR merges into a branch, it rebases the open Dependabot PRs targeting that branch that are blocked by being out of date.

Design (post adversarial review — 4 lenses, all ship-with-fixes)

  • Gates on mergeStateStatus BEHIND/DIRTY, not behind_by > 0. Dependabot's default rebase-strategy: auto already rebases on conflicts/dep-changes; it does not rebase a clean-but-behind PR to satisfy a strict "require up to date before merging" rule. So we act only on PRs that are actually blocked — which both fills that exact gap and avoids rebasing every behind PR (which would multiply CI churn). Inert on non-strict repos by design.
  • Identity: posts as the driver-digital-agents user (verified type: User) via AGENTS_GH_PAT. Dependabot ignores @dependabot commands from Apps/github-actions[bot].
  • cancel-in-progress: false — never cancel a run mid comment-loop (would silently drop PRs).
  • Guards: real merge, same-repo, non-Dependabot author (fork/Dependabot events lack the secret/normal token).
  • No AI, no external actions (only gh), PAT is the sole credential (token stays read-only).

Ships as v1.1.0. Caller stub goes into the kit (driver-bonsai-mcp templates/github/) after tagging.

Summary by CodeRabbit

  • Chores
    • Updated CI/CD automation infrastructure to improve dependency management processes.

Rebases Dependabot PRs that are BLOCKED by being out of date (mergeStateStatus
BEHIND/DIRTY) when a merge lands on their base — retires the manual
'@dependabot rebase'. Mechanical (no AI): posts the rebase command as the
driver-digital-agents user (Dependabot ignores App/github-actions[bot] commands).

Adversarial-reviewed (4 lenses). Key decisions from review:
- Gate on mergeStateStatus BEHIND/DIRTY, not behind_by>0: only rebases PRs that
  are actually blocked, which is the gap Dependabot's default rebase-strategy:auto
  leaves (auto rebases on conflicts/dep-changes, not to satisfy a strict
  up-to-date rule). Avoids a CI storm + is inert on non-strict repos.
- concurrency cancel-in-progress:false (never drop PRs mid comment-loop).
- same-repo + non-Dependabot + merged guard (secret/token context safety).
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

A new reusable GitHub Actions workflow (.github/workflows/dependabot-keep-current.yml) is added. After a real merge by a non-Dependabot user, it lists open Dependabot PRs on the same base branch, polls each PR's mergeStateStatus to avoid transient UNKNOWN readings, and posts a @dependabot rebase comment for any PR that is BEHIND or DIRTY.

Changes

Dependabot Keep-Current Reusable Workflow

Layer / File(s) Summary
Workflow contract, secrets, and concurrency setup
.github/workflows/dependabot-keep-current.yml
Defines the workflow_call trigger, declares the required AGENTS_GH_PAT secret, sets read-only permissions, and configures per-base-branch concurrency serialization with cancel-in-progress: false to prevent silent drops.
rebase-stale job: merge detection, status polling, and rebase comments
.github/workflows/dependabot-keep-current.yml
Implements the rebase-stale job gated on a real same-repo, non-Dependabot merge; enumerates open Dependabot PRs targeting the merged base branch; polls mergeStateStatus in a retry loop to resolve post-merge UNKNOWN; posts @dependabot rebase only for BEHIND or DIRTY PRs using AGENTS_GH_PAT.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, a merge just flew on by,
The Dependabot PRs caught my eye.
I poll the state — UNKNOWN, then clear —
BEHIND or DIRTY? Rebase, my dear!
With a PAT in paw and comments sent,
No stale PR shall cause us lament. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: introduction of a reusable GitHub Action workflow for automatically rebasing blocked Dependabot PRs, with version number and descriptive subtitle.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dependabot-keep-current

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/dependabot-keep-current.yml:
- Around line 63-65: The gh pr list command in the workflow is missing an
explicit --limit flag, which means it uses the CLI's default pagination limit
and can silently skip open Dependabot PRs on busy branches. Add the --limit flag
to the gh pr list command on line 63 to ensure all open Dependabot PRs are
processed. Set the limit to a sufficiently high number (such as 100 or more) to
capture all relevant open pull requests from the dependabot[bot] author.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a91b3ae0-ee9b-44f4-9cd6-eff26a9d20a1

📥 Commits

Reviewing files that changed from the base of the PR and between 1221799 and cb11ff2.

📒 Files selected for processing (1)
  • .github/workflows/dependabot-keep-current.yml

Comment on lines +63 to +65
nums=$(gh pr list --repo "$REPO" --state open --base "$BASE" \
--json number,author \
--jq '.[] | select(.author.login == "dependabot[bot]") | .number')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add an explicit PR list limit to avoid silently skipping Dependabot PRs.

Line 63 uses gh pr list without --limit; the CLI default cap can leave some open Dependabot PRs unprocessed on busy branches.

Suggested patch
-          nums=$(gh pr list --repo "$REPO" --state open --base "$BASE" \
+          nums=$(gh pr list --repo "$REPO" --state open --base "$BASE" --limit 200 \
                    --json number,author \
                    --jq '.[] | select(.author.login == "dependabot[bot]") | .number')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nums=$(gh pr list --repo "$REPO" --state open --base "$BASE" \
--json number,author \
--jq '.[] | select(.author.login == "dependabot[bot]") | .number')
nums=$(gh pr list --repo "$REPO" --state open --base "$BASE" --limit 200 \
--json number,author \
--jq '.[] | select(.author.login == "dependabot[bot]") | .number')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/dependabot-keep-current.yml around lines 63 - 65, The gh
pr list command in the workflow is missing an explicit --limit flag, which means
it uses the CLI's default pagination limit and can silently skip open Dependabot
PRs on busy branches. Add the --limit flag to the gh pr list command on line 63
to ensure all open Dependabot PRs are processed. Set the limit to a sufficiently
high number (such as 100 or more) to capture all relevant open pull requests
from the dependabot[bot] author.

@mcarter-astronautdev
mcarter-astronautdev merged commit c362604 into main Jun 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant