File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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"
You can’t perform that action at this time.
0 commit comments