Skip to content

Commit 6f71395

Browse files
rrrutledgeclaude
andcommitted
ci: auto-merge patch and minor Dependabot updates
Adds a workflow that approves Dependabot PRs and enables GitHub's native auto-merge for patch and minor version updates, so they merge on their own once branch protection is satisfied. Major updates still open a normal PR for review. This is inert until a maintainer enables "Allow auto-merge" on the repo and requires the CI checks on the main branch, so auto-merge waits for green before merging. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqiXti3H1onRAb3esyV1Dg
1 parent f310d49 commit 6f71395

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Dependabot auto-merge
2+
3+
# Auto-approve and enable auto-merge for Dependabot dependency updates, so GitHub
4+
# merges them on its own once branch protection is satisfied. GitHub merges only
5+
# after every required status check on `main` passes, so this is safe ONLY once the
6+
# repo requires its CI checks on the branch (see the PR that adds this file). Scoped
7+
# to patch and minor updates; major updates still open a normal PR for human review.
8+
9+
on: pull_request
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
dependabot-auto-merge:
17+
runs-on: ubuntu-latest
18+
if: github.event.pull_request.user.login == 'dependabot[bot]'
19+
steps:
20+
- name: Fetch Dependabot metadata
21+
id: metadata
22+
uses: dependabot/fetch-metadata@v2
23+
with:
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Approve and enable auto-merge for patch and minor updates
27+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
28+
run: |
29+
gh pr review --approve "$PR_URL"
30+
gh pr merge --auto --squash "$PR_URL"
31+
env:
32+
PR_URL: ${{ github.event.pull_request.html_url }}
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)