Dependabot auto-merge strategy
This document explains AlignTrue’s hybrid approach to automatically merging Dependabot PRs.
Overview
Goal: Save maintainer time on routine dependency updates while preserving manual review for higher-risk changes.
Strategy:
- ✅ Auto-merge: devDependencies, patch & minor updates
- 🚫 Manual review: production dependencies, major version bumps
Configuration
1. .github/dependabot.yml
Dependabot is configured to:
- Create separate PRs per directory (workspace isolation)
- Label PRs by scope (devDependencies, schema, cli, web, docs, etc.)
- Group updates intelligently (production vs development)
- Ignore unsafe updates (e.g., Next.js major versions)
Key scopes:
- Root
/: dev-dependencies only → auto-merge safe - Packages (
/packages/schema,/packages/cli, etc.): patch/minor only → auto-merge safe - Web app (
/apps/web): split into dev (auto-merge) + production (manual review) - Docs app (
/apps/docs): split into dev (auto-merge) + production (manual review)
2. .github/workflows/dependabot-auto-merge.yml
GitHub Actions workflow that:
- Detects all Dependabot PRs
- Checks if PR is labeled as “safe” (devDependencies OR patch/minor without “requires-review”)
- Auto-approves safe PRs with rationale
- Waits for CI to pass (max 10 minutes)
- Enables GitHub’s auto-merge (squash strategy)
- Leaves unsafe PRs pending for manual review
Trigger: Runs on all pull requests to main
Conditions:
- Only acts on PRs from
dependabot[bot] - Requires passing CI checks before merge
- Uses squash merge to keep commit history clean
What gets auto-merged
✅ Automatically merged once CI passes:
- All devDependencies (test frameworks, linters, build tools)
- Patch updates to production packages (bug fixes)
- Minor updates to production packages (new backward-compatible features)
❌ Requires manual review:
- Major version bumps (Next.js 15→16, etc.)
- Production dependencies not explicitly allowed
- Any PR labeled “requires-review”
What to watch for
-
CI failures: If a Dependabot PR fails CI, auto-merge is blocked. Review the error and decide:
- Is it a real incompatibility? → Manual fix or manual rejection
- Is it a flaky test? → Re-run CI or merge manually
-
Security patches: Auto-merged if they’re patch-level updates. Validate the patch notes if unsure.
-
Monorepo issues: Web and docs apps have both auto-merge and manual-review rules to balance safety with developer experience.
Performance impact
- Devs: Zero overhead. PRs auto-merge while you work on other things.
- CI: One full test run per Dependabot PR. Runs on Linux + Windows per
.github/workflows/ci.yml. - Review time: ~0 seconds for safe updates, on-demand for risky ones.
Disabling auto-merge
To temporarily disable auto-merge or change the strategy:
- Disable entirely: Comment out the
dependabot-auto-merge.ymlworkflow - Change scopes: Edit
.github/dependabot.ymllabels and allow/ignore rules - Change merge method: Update
dependabot-auto-merge.ymlto usemergeorrebaseinstead ofsquash
Testing the setup
After pushing these files:
- Wait for a new Dependabot PR to arrive (weekly on Mondays)
- Check the PR for:
- Expected labels (e.g., “devDependencies”, “cli”, “requires-review”)
- Auto-approval comment from the workflow
- Auto-merge badge once CI passes
- Monitor GitHub Actions to see the workflow logs