Skip to content

Commit 0ec500e

Browse files
ci(dependabot): add auto-merge workflow that updates branch before merging
1 parent 0172cac commit 0ec500e

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 auto-merge
2+
run-name: Dependabot auto-merge
3+
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- dev
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
auto-merge:
16+
if: github.actor == 'dependabot[bot]'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Fetch Dependabot metadata
20+
id: metadata
21+
uses: dependabot/fetch-metadata@v2
22+
with:
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Update branch with latest dev
26+
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
27+
run: gh pr update-branch "$PR_URL" || true
28+
env:
29+
PR_URL: ${{ github.event.pull_request.html_url }}
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Enable auto-merge for patch and minor updates
33+
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
34+
run: gh pr merge --auto --merge "$PR_URL"
35+
env:
36+
PR_URL: ${{ github.event.pull_request.html_url }}
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)