Skip to content

Commit 2bf3529

Browse files
[chore] Add workflow to auto merge dependency upgrades (#174) (#175)
1 parent 5f71d5d commit 2bf3529

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Auto-merge Dependabot PRs
2+
run-name: Auto-merge - PR #${{ github.event.pull_request.number }}
3+
4+
on:
5+
pull_request_target:
6+
types:
7+
- opened
8+
- synchronize
9+
- reopened
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
auto-merge:
17+
runs-on: ubuntu-latest
18+
if: github.actor == '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 PR
27+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
28+
run: gh pr review --approve "$PR_URL"
29+
env:
30+
PR_URL: ${{ github.event.pull_request.html_url }}
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Enable auto-merge
34+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
35+
run: gh pr merge --auto --squash "$PR_URL"
36+
env:
37+
PR_URL: ${{ github.event.pull_request.html_url }}
38+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)