Skip to content

Commit d6b78eb

Browse files
shigechikaclaude
andauthored
ci: dependabot auto-merge workflow (patch/minor only) (#32)
Part of fleet maintenance automation (pitwalk, AIaC #27 Step 2). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent d14503e commit d6b78eb

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: dependabot-automerge
2+
3+
# Auto-merge Dependabot PRs for patch/minor bumps once required checks pass.
4+
# Major bumps are left for human review (behaviour can change across a major).
5+
#
6+
# NOTE on `gh pr merge --auto`: the global "manual workflow" rule avoids --auto,
7+
# but this is the sanctioned exception — the whole point of this workflow is
8+
# hands-off dependency maintenance. --auto respects the repo's required status
9+
# checks: with branch protection it waits for CI; without it, it merges when
10+
# mergeable. Enable "Allow auto-merge" on the repo for this to work.
11+
12+
on: pull_request
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
automerge:
20+
runs-on: ubuntu-latest
21+
# Only act on Dependabot's own PRs.
22+
if: github.event.pull_request.user.login == 'dependabot[bot]'
23+
steps:
24+
- name: Fetch Dependabot metadata
25+
id: meta
26+
uses: dependabot/fetch-metadata@v2
27+
28+
- name: Enable auto-merge for patch/minor
29+
if: >-
30+
steps.meta.outputs.update-type == 'version-update:semver-patch' ||
31+
steps.meta.outputs.update-type == 'version-update:semver-minor'
32+
env:
33+
# html_url is a GitHub-controlled canonical URL; passed via env, not
34+
# interpolated into the run: script.
35+
PR_URL: ${{ github.event.pull_request.html_url }}
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: gh pr merge --auto --squash "$PR_URL"

0 commit comments

Comments
 (0)