Skip to content

Commit 7121bb5

Browse files
committed
Add Dependabot configuration with auto-merge workflow
Configure Dependabot to monitor Go modules, GitHub Actions, and Docker images with daily/weekly checks. Group Kubernetes dependencies and all GitHub Actions into single PRs to reduce noise. Auto-merge minor and patch updates after CI passes, while flagging major updates for manual review.
1 parent c3d0a38 commit 7121bb5

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Go modules
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
open-pull-requests-limit: 10
9+
labels:
10+
- "dependencies"
11+
- "go"
12+
commit-message:
13+
prefix: "chore(deps)"
14+
include: "scope"
15+
groups:
16+
kubernetes:
17+
patterns:
18+
- "k8s.io/*"
19+
- "sigs.k8s.io/*"
20+
21+
# Enable version updates for GitHub Actions
22+
- package-ecosystem: "github-actions"
23+
directory: "/"
24+
schedule:
25+
interval: "weekly"
26+
day: "monday"
27+
time: "06:00"
28+
labels:
29+
- "dependencies"
30+
- "github-actions"
31+
commit-message:
32+
prefix: "chore(github-actions)"
33+
include: "scope"
34+
groups:
35+
github-actions:
36+
patterns:
37+
- "*"
38+
39+
# Enable version updates for Docker
40+
- package-ecosystem: "docker"
41+
directory: "/"
42+
schedule:
43+
interval: "daily"
44+
labels:
45+
- "dependencies"
46+
- "docker"
47+
commit-message:
48+
prefix: "chore(docker)"
49+
include: "scope"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: github.actor == 'dependabot[bot]'
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v2
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
19+
- name: Auto-approve PR
20+
run: gh pr review --approve "$PR_URL"
21+
env:
22+
PR_URL: ${{ github.event.pull_request.html_url }}
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Enable auto-merge for minor and patch updates
26+
if: |
27+
steps.metadata.outputs.update-type == 'version-update:semver-minor' ||
28+
steps.metadata.outputs.update-type == 'version-update:semver-patch'
29+
run: |
30+
gh pr merge --auto --squash "$PR_URL"
31+
gh pr comment "$PR_URL" --body "✅ Auto-merge enabled. This PR will merge automatically once all checks pass."
32+
env:
33+
PR_URL: ${{ github.event.pull_request.html_url }}
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Comment on major updates
37+
if: steps.metadata.outputs.update-type == 'version-update:semver-major'
38+
run: |
39+
gh pr comment "$PR_URL" --body "⚠️ **Major version update** - requires manual review before merging."
40+
env:
41+
PR_URL: ${{ github.event.pull_request.html_url }}
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)