Skip to content

Merge passing Dependabot PRs automatically - #131

Merged
koppor merged 1 commit into
mainfrom
dependabot-automerge
Nov 18, 2026
Merged

koppor merged 1 commit into
mainfrom
dependabot-automerge

Conversation

@koppor

@koppor koppor commented Nov 18, 2026

Copy link
Copy Markdown
Member

Dependabot PRs no longer need someone to click merge: once the check workflow passes, they are squash-merged and GitHub Pages is redeployed. Major version bumps are left open for manual review.

Test: after merging, the next non-major Dependabot PR merges itself once its check passes, and a check run on main follows.

🤖 Generated with Claude Code

Dependabot PRs that pass the check workflow are now merged and deployed without manual action; major version bumps still wait for a human.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@koppor
koppor marked this pull request as ready for review November 18, 2026 11:49
@koppor
koppor merged commit ba5be42 into main Nov 18, 2026
2 checks passed
@koppor
koppor deleted the dependabot-automerge branch November 18, 2026 11:49
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Automatically merge passing non-major Dependabot PRs

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Squash-merge Dependabot PRs after successful checks, while leaving major upgrades for manual
 review.
• Require the checked commit to match the PR head before merging.
• Run the main check explicitly so GitHub Pages redeploys after a token-authenticated merge.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: repository dependency and release automation.
  • This capability is the user-visible repository operation introduced by the workflow: selecting an eligible Dependabot PR after its check and merging it.
  • The title gate, actor gate, head-SHA match, and merge command are all parts of this one bounded automation behavior.
  • This is a distinct operational outcome within the same bounded repository release-automation scope: the new workflow explicitly compensates for a GITHUB_TOKEN merge not triggering the push workflow by dispatching the main-branch check, whose Pages step publishes main.
Sources

.github/workflows/dependabot-merge.yml[5-15]

on:
  workflow_run:
    workflows: [check]
    types: [completed]

jobs:
  merge:
    if: >-
      github.event.workflow_run.event == 'pull_request' &&
      github.event.workflow_run.conclusion == 'success' &&
      github.event.workflow_run.actor.login == 'dependabot[bot]'
Behavioral complexity 🟡 Medium 🧩 Interacting branches, Coordinated invariants

  • Before, dependency PR merging and the main-branch deployment were separate GitHub event-driven operations.
  • After, a completed pull-request check is used as the trigger, several event predicates and a title/version branch determine eligibility, the merge is constrained by the tested head SHA, and a second workflow is dispatched after the merge.
  • New correctness conditions are: only the intended Dependabot PR may be merged; the merged commit must be the one that passed checks; and the post-merge deployment must be started after a successful merge despite the GITHUB_TOKEN push-trigger limitation.
  • The title parsing and shell branches are straightforward individually, but their interaction with event payloads, stale PR state, partial side effects, and follow-up workflow ordering introduces the nontrivial state coordination.
Sources

.github/workflows/dependabot-merge.yml[5-15]

on:
  workflow_run:
    workflows: [check]
    types: [completed]

jobs:
  merge:
    if: >-
      github.event.workflow_run.event == 'pull_request' &&
      github.event.workflow_run.conclusion == 'success' &&
      github.event.workflow_run.actor.login == 'dependabot[bot]'
Potential damage 🟡 Medium 🩹 Temporary loss

  • A false-negative title match, missing/invalid workflow-run PR data, or a rejected merge leaves eligible dependency updates requiring manual handling.
  • This is a temporary loss of automation rather than data loss; reverting the workflow restores the prior repository behavior, while an already attempted merge may still require checking the PR state.
  • Manual merge or rerun is supported in principle, but the source does not establish an automatic retry, bounded attempt policy, or repair worker.
  • Code rollback restores the workflow logic but does not undo a merge that already occurred.
Assessed commit 6e4b32f > Snapshot assessment: the current PR revision could not be verified.
Diagram

graph TD
  PR["Dependabot PR"] --> Check["PR check"] --> Gate["Success and actor gate"] --> Version{"Same major?"}
  Version -->|Yes| Merge["Squash merge"] --> Main["Main check"] --> Pages["Pages deploy"]
  Version -->|No| Review["Manual review"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use Dependabot update metadata
  • ➕ Classifies version changes without relying on PR title wording.
  • ➕ Can handle additional Dependabot title formats more predictably.
  • ➖ Adds an action and more workflow steps to a small automation.

Recommendation: The workflow-run approach fits the existing check and Pages deployment setup: it checks the tested SHA and explicitly dispatches the deployment workflow that a GITHUB_TOKEN merge would not trigger. Consider structured Dependabot metadata if grouped or differently titled updates need automatic merging; the current title pattern leaves those for manual review.

Files changed (1) +36 / -0

Other (1) +36 / -0
dependabot-merge.ymlAdd gated Dependabot merge and deployment workflow +36/-0

Add gated Dependabot merge and deployment workflow

• Adds a workflow triggered by completed checks that acts only on successful Dependabot pull-request runs. It squash-merges upgrades whose parsed major version is unchanged, verifies the checked head commit, and dispatches the main check for Pages deployment; other titles remain open.

.github/workflows/dependabot-merge.yml

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1)

Grey Divider


Remediation recommended

1. Action updates can bypass major review 🐞 Bug
Description
The title matcher treats the first digits of a from ... to ... pair as version majors, even when
the pair contains commit SHAs. For SHA-formatted GitHub Actions update titles, matching leading
digits permit an update to merge without determining whether it is a major version bump, while other
SHA prefixes leave non-major updates open.
Code

.github/workflows/dependabot-merge.yml[30]

+          if [[ $title =~ from\ v?([0-9]+)[^\ ]*\ to\ v?([0-9]+) ]] && [ "${BASH_REMATCH[1]}" = "${BASH_REMATCH[2]}" ]; then
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The matcher can mistake digits at the start of commit SHAs for semantic-version majors when handling GitHub Actions updates.
## Fix Focus Areas
- .github/workflows/dependabot-merge.yml[29-35]
- .github/dependabot.yml[3-6]
## Recommended Fix
Require an unambiguous semantic-version pair before comparing majors. For SHA-formatted Actions updates, resolve the associated versions or leave the PR for manual review; do not compare SHA prefixes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

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