Skip to content

Commit 898cacd

Browse files
authored
Automate dependency monitoring and patch-level auto-merge (#16)
With CI in place (#15), the repository can gate dependency updates on passing checks. Dependabot now monitors both Go modules and GitHub Actions on a weekly schedule, and patch-level updates auto-merge once CI passes. Minor and major updates still require human review. TODO comments in the automerge workflow mark where Claude-assisted review steps will slot in once the Claude Code workflow (#5) lands: approve-and-merge for minor updates, comment-only analysis for major ones. This addresses three of the four checkboxes in #6; the remaining one (LLM-assisted review) is blocked on #5. Relates to #6
2 parents 0e57482 + 0393e02 commit 898cacd

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Dependabot Configuration
2+
#
3+
# Weekly update checks balance responsiveness with notification fatigue.
4+
# Patch updates auto-merge via dependabot-automerge workflow.
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: gomod
9+
directory: /
10+
schedule:
11+
interval: weekly
12+
commit-message:
13+
prefix: "go.mod"
14+
labels:
15+
- dependencies
16+
17+
- package-ecosystem: github-actions
18+
directory: /
19+
schedule:
20+
interval: weekly
21+
commit-message:
22+
prefix: "github"
23+
labels:
24+
- dependencies
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Dependabot Auto-merge Workflow
2+
#
3+
# Patch updates auto-merge after CI passes. Minor and major updates
4+
# require human review until LLM-assisted review is available (#5).
5+
#
6+
# Squash commits default to using the PR description as body, but
7+
# Dependabot PRs include lengthy changelogs and compatibility notes.
8+
# The merge step overrides the body to keep commit messages clean.
9+
10+
name: "🤖 Dependabot"
11+
12+
on:
13+
pull_request:
14+
branches: [main]
15+
# Path filter avoids creating workflow runs for unrelated PRs while
16+
# still catching all Dependabot updates (Go modules and Actions).
17+
paths:
18+
- "go.mod"
19+
- "go.sum"
20+
- ".github/workflows/**"
21+
22+
permissions:
23+
contents: write # Required by: gh pr merge --auto
24+
pull-requests: write # Required by: gh pr review --approve
25+
26+
jobs:
27+
automerge:
28+
name: Review & Merge
29+
runs-on: ubuntu-latest
30+
if: github.actor == 'dependabot[bot]'
31+
steps:
32+
- name: Fetch Dependabot metadata
33+
id: metadata
34+
uses: dependabot/fetch-metadata@v2
35+
with:
36+
github-token: "${{ secrets.GITHUB_TOKEN }}"
37+
compat-lookup: true
38+
39+
- name: Approve patch
40+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
41+
run: gh pr review --approve -b "Patch update — auto-approved" "$PR_URL"
42+
env:
43+
PR_URL: ${{ github.event.pull_request.html_url }}
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
# TODO(#5): Review minor updates with Claude before auto-merging.
47+
# Once the Claude Code workflow lands, add a step here that uses
48+
# claude-code-action to review the diff and approve if acceptable,
49+
# followed by an auto-merge step gated on the same condition.
50+
51+
# TODO(#5): Analyze major updates with Claude, require human merge.
52+
# Major updates may contain breaking changes. The planned step uses
53+
# claude-code-action to post a review comment with migration notes
54+
# and risk analysis, but does not approve or merge. A human reads
55+
# the analysis and decides whether to proceed.
56+
57+
- name: Auto-merge patch
58+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
59+
run: gh pr merge --auto --squash "$PR_URL" --body "$BODY"
60+
env:
61+
PR_URL: ${{ github.event.pull_request.html_url }}
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
BODY: |
64+
This patch update was merged automatically since patch-level
65+
changes carry minimal risk of breaking existing functionality.
66+
67+
Compatibility score: ${{ steps.metadata.outputs.compatibility-score }}%

0 commit comments

Comments
 (0)