Dependency Management
Overview
CareConnect uses Dependabot for automated dependency updates. Dependencies are updated weekly (npm) and monthly (GitHub Actions) to maintain security and leverage new features while minimizing disruption.
Dependabot Configuration
Update Schedule
- npm Dependencies: Every Monday at 09:00 UTC
- GitHub Actions: First Monday of each month
- Open PR Limit: 10 for npm, 5 for GitHub Actions
Grouping Strategy
Dependabot groups updates to reduce PR noise:
| Group | Includes | Auto-Merge |
|---|---|---|
| production-patch | Patch updates (production) | ✅ Yes |
| production-minor | Minor updates (production) | ❌ Manual |
| development-dependencies | Patch+Minor (dev dependencies) | ✅ Patch |
| github-actions | All GitHub Actions updates | ❌ Manual |
Ignored Updates
The following major version updates are ignored and require manual upgrades:
- Next.js: Major versions (requires migration guide review)
- React/React-DOM: Major versions (breaking changes common)
- TypeScript: Major versions (syntax/type system changes)
- @types/react: Major versions (tied to React version)
- @xenova/transformers: Major versions (ML model compatibility)
Auto-Merge Policy
The .github/workflows/dependabot-auto-merge.yml workflow automatically handles safe updates:
Auto-Approved
- ✅ Patch updates (all dependencies)
- ✅ Minor updates (dev dependencies only)
Auto-Merged
- ✅ Patch updates (after CI passes)
Manual Review Required
- ⚠️ Major version updates (any dependency)
- ⚠️ Minor updates (production dependencies)
Handling Dependabot PRs
Quick Reference
# View open Dependabot PRs
gh pr list --label dependencies
# Approve a PR
gh pr review <number> --approve
# Merge after CI passes
gh pr merge <number> --auto --squash
# Close without merging
gh pr close <number>
Review Checklist
When reviewing a Dependabot PR:
- Check CI Status: All checks must pass
- ✅ Tests (895+ passing)
- ✅ Type check
- ✅ Lint
-
✅ Coverage thresholds
-
Review Changelog: Check linked release notes
- Breaking changes?
- New features relevant to us?
-
Security fixes?
-
Check Size Impact: Review bundle size diff (if applicable)
- Acceptable increase?
-
Optimization opportunities?
-
Test Locally (for major/minor production updates):
- Approve & Merge: If all checks pass
Common Scenarios
Scenario 1: Patch Update (Auto-Merged)
What happens:
- Dependabot opens PR (e.g., "chore(deps): bump axios from 1.6.0 to 1.6.1")
- CI runs automatically
- Auto-merge workflow approves and enables auto-merge
- PR merges when CI passes
Action needed: None (monitor for CI failures)
Scenario 2: Minor Production Update (Manual Review)
What happens:
- Dependabot opens PR (e.g., "chore(deps): bump next-intl from 3.0.0 to 3.1.0")
- CI runs automatically
- Auto-merge workflow posts or updates one sticky "Manual Review Required" comment
Action needed:
- Review changelog for breaking changes
- Test locally if unsure
- Approve and merge if safe
Scenario 3: Major Update (Blocked)
What happens:
- Update is blocked by
ignorerules independabot.yml - No PR is created
Action needed:
- Periodically check for major updates:
- Create manual PR when ready to upgrade
- Follow framework-specific migration guides
Conflict Resolution
If a Dependabot PR has merge conflicts:
- Close the conflicted PR:
-
Dependabot will recreate it (usually within hours)
-
Alternatively, manually resolve:
Security Updates
Dependabot also creates security updates when vulnerabilities are detected.
Pull Request Dependency Review
CareConnect now also runs GitHub's dependency review action on pull requests via .github/workflows/dependency-review.yml.
What it does:
- compares dependency manifest and lockfile changes introduced by the PR
- fails the PR when newly introduced dependencies carry high or critical advisories
- complements
npm auditinstead of replacing it
What it does not do:
- it does not block on unrelated historical ecosystem noise outside the PR diff
- it does not replace local review of changelogs, bundle impact, or framework compatibility
Identifying Security Updates
Security PRs are labeled with:
dependenciessecurity(GitHub adds this automatically)
Handling Security Updates
Priority: HIGH - Address within 24-48 hours.
- Review vulnerability details: Click "View security advisory"
- Check severity: Critical/High = immediate, Medium/Low = next sprint
- Test thoroughly: Security fixes can have side effects
- Merge quickly: Don't delay security patches
Emergency Security Updates
For critical vulnerabilities in production:
# Quick fix workflow
gh pr checkout <security-pr-number>
npm install
npm run build
npm test
# If tests pass
gh pr review <number> --approve
gh pr merge <number> --squash
# Deploy immediately
vercel --prod
Troubleshooting
Dependabot PRs Not Created
Symptoms: No PRs despite weekly schedule.
Causes:
- PR limit reached (10 for npm, 5 for actions)
- All dependencies up-to-date
- Dependabot disabled (check repo settings)
Solution:
# Check open Dependabot PRs
gh pr list --label dependencies
# If at limit, merge or close some PRs
# Dependabot will create new ones in next run
CI Failures on Dependabot PR
Symptoms: Tests fail, type errors, or lint errors.
Common Causes:
- Breaking change in dependency (even for minor/patch)
- Type changes in @types packages
- Peer dependency conflicts
Solution:
- Review failure logs in GitHub Actions
- Close PR if unfixable:
- Pin version in
package.jsonif needed:
Dependabot Recreating Closed PRs
Symptoms: PR keeps getting recreated after closing.
Cause: Dependency is out of date and not in ignore list.
Solution:
Add to .github/dependabot.yml:
Or ignore all updates for a package:
Bundle Size Increased Significantly
Symptoms: Bundle size PR comment shows large increase.
Cause: New dependency or larger version.
Solution:
- Review bundle analyzer artifacts
- Check if increase is justified
- Consider alternatives or dynamic imports
- Close PR if unacceptable
Best Practices
1. Review Weekly
Set aside time every Monday morning to:
- Review open Dependabot PRs
- Merge safe updates quickly
- Schedule time for major updates
2. Don't Accumulate PRs
Merge or close PRs regularly:
- Week 1: Open PRs = 3-5 (healthy)
- Week 4: Open PRs = 10+ (problem!)
Why? Dependabot stops creating new PRs at the limit.
3. Group Related Updates
Before merging, check if multiple PRs update related packages:
- Close individual PRs
- Update manually in a single PR
- Example: React + React-DOM + @types/react
4. Read Changelogs
Always check release notes for:
- New features we can use
- Deprecation warnings
- Performance improvements
- Breaking changes
5. Monitor Dashboard
Check Dependabot dashboard regularly:
- Repo → Insights → Dependency graph → Dependabot
Shows:
- Update frequency
- Vulnerabilities
- Compatibility score
Configuration Reference
dependabot.yml Location
.github/dependabot.yml
Key Settings
| Setting | Value | Rationale |
|---|---|---|
interval | weekly | Balance freshness vs. noise |
day | monday | Start of week, fresh attention |
open-pull-requests-limit | 10 | Enough for grouped updates |
commit-message.prefix | chore(deps) | Conventional commits |
labels | dependencies, automated | Easy filtering |
Modifying Configuration
After editing .github/dependabot.yml:
- Changes take effect immediately (next run)
- No need to trigger manually
- Verify syntax: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
Auto-Merge Workflow
How It Works
.github/workflows/dependabot-auto-merge.yml:
- Triggers on Dependabot PR (opened/updated)
- Fetches metadata (update type, dependency type)
- Auto-approves safe updates (patch, dev minor)
- Enables auto-merge for patch updates only
- Comments on PRs requiring manual review
Disabling Auto-Merge
To disable auto-merge for all updates:
- Delete
.github/workflows/dependabot-auto-merge.yml - Or add to workflow:
Adjusting Auto-Merge Policy
To auto-merge minor updates for production:
Edit .github/workflows/dependabot-auto-merge.yml:
# Change this condition:
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
# To this:
if: |
(steps.metadata.outputs.update-type == 'version-update:semver-patch') ||
(steps.metadata.outputs.update-type == 'version-update:semver-minor')
⚠️ Warning: Auto-merging minor updates is riskier. Only enable if you're confident in test coverage.
Metrics & Monitoring
Key Metrics
Track these weekly:
- Open PRs: Should be <5
- Merge Time: Patch updates <24h, minor <7 days
- Security Updates: 100% merged within 48h
- Outdated Packages: Run
npm outdatedmonthly
Example Dashboard Query
# PRs merged this week
gh pr list --state merged --label dependencies --limit 20 | grep "$(date -d '7 days ago' +%Y-%m-%d)"
# Open Dependabot PRs
gh pr list --label dependencies
# Security PRs
gh pr list --label dependencies,security
Related Documentation
Future Enhancements
Potential improvements:
- Renovate Migration: Consider Renovate Bot for more advanced features
- Better grouping logic
- Auto-merge rules more flexible
-
Scheduling per package group
-
Dependency Dashboard: Visual tracking of update status
-
Breaking Change Detection: Automated changelog parsing
-
Performance Impact Analysis: Link dependency updates to bundle size changes