How to Set Up Dependabot Automationยถ
This guide shows you how to configure Dependabot for automated dependency management in the Qubinode KVM Host Setup Collection.
๐ฏ Goalยถ
Set up comprehensive Dependabot automation for:
Automated security updates
Regular dependency updates
GitHub Actions workflow updates
Container image updates for testing
Automated release triggers
๐ Prerequisitesยถ
Repository admin access
Understanding of GitHub repository settings
Familiarity with GitHub Actions workflows
Basic knowledge of dependency management
๐ Step 1: Enable Dependabot Featuresยถ
Repository Settingsยถ
Navigate to Settings > General > Features
and enable:
โ Issues - Required for Dependabot to create issue reports
โ Pull Requests - Essential for Dependabot PRs
โ Actions - Required for automated workflow triggers
Organization Security Settingsยถ
Navigate to Organization Settings > Code security and analysis
and enable:
โ Dependency graph - Required for Dependabot to analyze dependencies
โ Dependabot alerts - Security vulnerability notifications
โ Dependabot security updates - Automatic security fix PRs
โ Dependabot version updates - Regular dependency updates
๐ง Step 2: Configure Branch Protectionยถ
Navigate to Settings > Branches > Branch protection rules
for the main
branch:
Required Settingsยถ
โ Require pull request reviews before merging
โ Require status checks to pass before merging
โ Require branches to be up to date before merging
โ Include administrators (recommended)
Required Status Checksยถ
RHEL Compatibility Matrix Testing / validate-local-testing
RHEL Compatibility Matrix Testing / container-compatibility-validation
Ansible Lint / ansible-lint
Security Scan / security-scan
๐ Step 3: Create Dependabot Configurationยถ
Create .github/dependabot.yml
:
version: 2
updates:
# GitHub Actions dependencies
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 10
reviewers:
- "qubinode/maintainers"
assignees:
- "qubinode/maintainers"
commit-message:
prefix: "ci"
include: "scope"
labels:
- "dependencies"
- "github-actions"
- "security"
allow:
- dependency-type: "direct"
update-type: "version-update:semver-patch"
# Docker dependencies for Molecule testing
- package-ecosystem: "docker"
directory: "/molecule"
schedule:
interval: "weekly"
day: "tuesday"
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 8
commit-message:
prefix: "ci"
include: "scope"
labels:
- "dependencies"
- "docker"
- "testing"
- "container-compatibility"
# Python dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 10
commit-message:
prefix: "deps"
include: "scope"
labels:
- "dependencies"
- "python"
- "molecule"
allow:
- dependency-type: "direct"
update-type: "security"
# Ansible Galaxy dependencies
- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "weekly"
day: "thursday"
time: "09:00"
timezone: "UTC"
commit-message:
prefix: "deps"
include: "scope"
labels:
- "dependencies"
- "ansible-galaxy"
๐ค Step 4: Set Up Auto-Merge Workflowยถ
Create .github/workflows/dependabot-auto-merge.yml
:
name: Dependabot Auto-merge
on:
pull_request:
types: [opened, synchronize]
permissions:
contents: write
pull-requests: write
checks: read
jobs:
auto-merge:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Check if PR is ready for auto-merge
id: check-pr
run: |
# Only auto-merge patch updates and security fixes
if [[ "${{ github.event.pull_request.title }}" =~ ^(ci|deps)\(.*\):.*patch.*$ ]] || \
[[ "${{ github.event.pull_request.title }}" =~ .*security.* ]]; then
echo "auto_merge=true" >> $GITHUB_OUTPUT
else
echo "auto_merge=false" >> $GITHUB_OUTPUT
fi
- name: Enable auto-merge for safe updates
if: steps.check-pr.outputs.auto_merge == 'true'
run: |
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add review request for major updates
if: steps.check-pr.outputs.auto_merge == 'false'
run: |
gh pr edit "$PR_URL" --add-reviewer "qubinode/maintainers"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
๐ Step 5: Configure Security Settingsยถ
Enable Security Featuresยถ
Navigate to Settings > Code security and analysis
:
โ Secret scanning - Detects accidentally committed secrets
โ Code scanning - Static analysis for vulnerabilities
โ Private vulnerability reporting - Responsible disclosure
Configure Vulnerability Alertsยถ
Set severity threshold to โMediumโ or higher
Enable email notifications for maintainers
Configure Slack/Teams integration if desired
๐ฅ Step 6: Set Up Team Permissionsยถ
Create Maintainers Teamยถ
Navigate to
Organization > Teams
Create
@qubinode/maintainers
teamAdd appropriate maintainers
Grant โWriteโ access to repository
Configure Review Assignmentsยถ
In repository settings:
Set maintainers team as default reviewers
Configure auto-assignment for Dependabot PRs
Set up CODEOWNERS file if needed
โ Step 7: Test Dependabot Setupยถ
Manual Triggerยถ
# Trigger Dependabot manually (GitHub CLI)
gh api repos/:owner/:repo/dependabot/updates \
--method POST \
--field package_ecosystem=github-actions
Verify Configurationยถ
Check
Insights > Dependency graph
Review
Security > Dependabot alerts
Monitor
Actions
tab for Dependabot workflows
๐ Step 8: Monitor and Maintainยถ
Weekly Maintenance Tasksยถ
Review and merge Dependabot PRs
Check for failed status checks
Update auto-merge rules if needed
Review security alerts
Monthly Reviewยถ
Analyze Dependabot insights
Review update frequency and limits
Adjust configuration based on PR volume
Update team assignments if needed
Quarterly Assessmentยถ
Review overall dependency health
Update Dependabot configuration
Assess auto-merge effectiveness
Plan major dependency upgrades
๐จ Troubleshootingยถ
Common Issuesยถ
Problem: Dependabot PRs not being created Solution:
Verify dependency files exist (requirements.txt, package.json)
Check Dependabot permissions in organization settings
Review branch protection rules for conflicts
Problem: Auto-merge not working Solution:
Verify all status checks are passing
Check that required reviews are satisfied
Ensure auto-merge is enabled in branch protection
Problem: Too many PRs being created Solution:
Reduce
open-pull-requests-limit
in dependabot.ymlChange update frequency from daily to weekly
Restrict allowed update types
Debug Commandsยถ
# Check Dependabot status
gh api repos/:owner/:repo/dependabot/updates
# List open Dependabot PRs
gh pr list --author "dependabot[bot]"
# Check workflow runs
gh run list --workflow="dependabot-auto-merge.yml"
๐ฏ Success Metricsยถ
Key Performance Indicatorsยถ
Security Response Time: < 24 hours for critical vulnerabilities
Update Frequency: Weekly for non-security updates
Auto-merge Rate: > 80% for patch updates
Manual Review Rate: < 20% requiring manual intervention
Monitoring Dashboardยถ
Track these metrics:
Number of Dependabot PRs per week
Time to merge security updates
Failed status checks on Dependabot PRs
Manual intervention frequency