Skip to content

Commit 9020b77

Browse files
Combine Dependabot auto-approve and auto-merge workflows
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 1f56c1d commit 9020b77

3 files changed

Lines changed: 39 additions & 53 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Dependabot Auto-Approve & Auto-Merge
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
dependabot:
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.user.login == 'dependabot[bot]'
15+
16+
steps:
17+
- name: Get Dependabot metadata
18+
id: metadata
19+
uses: dependabot/fetch-metadata@v2
20+
with:
21+
github-token: ${{ github.token }}
22+
23+
- name: Approve minor and patch updates
24+
if: |
25+
steps.metadata.outputs.update-type == 'version-update:semver-minor' ||
26+
steps.metadata.outputs.update-type == 'version-update:semver-patch'
27+
run: gh pr review --approve "$PR_URL"
28+
env:
29+
PR_URL: ${{ github.event.pull_request.html_url }}
30+
GH_TOKEN: ${{ github.token }}
31+
32+
- name: Enable auto-merge for minor and patch updates
33+
if: |
34+
steps.metadata.outputs.update-type == 'version-update:semver-minor' ||
35+
steps.metadata.outputs.update-type == 'version-update:semver-patch'
36+
run: gh pr merge --auto --squash "$PR_URL"
37+
env:
38+
PR_URL: ${{ github.event.pull_request.html_url }}
39+
GH_TOKEN: ${{ github.token }}

.github/workflows/dependabot-auto-approve.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/dependabot-auto-merge.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)