Skip to content

Commit a82db57

Browse files
Enabling auto merge for dependabot
1 parent 7a5a9c8 commit a82db57

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# .github/dependabot.yml
12
version: 2
23
updates:
34

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,36 @@ permissions:
99

1010
jobs:
1111
dependabot:
12+
name: Approve & auto-merge Dependabot PRs
1213
runs-on: ubuntu-latest
14+
15+
# Only run for PRs opened by Dependabot
1316
if: github.event.pull_request.user.login == 'dependabot[bot]'
17+
1418
steps:
19+
# 1) Fetch Dependabot metadata (pinned SHA + tag comment for humans/renovators)
1520
- name: Dependabot metadata
1621
id: metadata
17-
uses: dependabot/fetch-metadata@21025c7d3b7c1eb5122b2f4f30b18d6c8b8c52df # v2.5.0
22+
uses: dependabot/fetch-metadata@21025c7d3b7c1eb5122b2f4f30b18d6c8b8c52df
1823
with:
19-
github-token: "${{ secrets.GITHUB_TOKEN }}"
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
# 2) (Optional) Log what’s being updated for troubleshooting
27+
- name: Summarize update
28+
run: |
29+
echo "Dependencies: ${{ steps.metadata.outputs.dependency-names }}"
30+
echo "Update type: ${{ steps.metadata.outputs.update-type }}"
2031
21-
- name: Approve PR
32+
# 3) Approve the PR (required if code owner reviews are enforced)
33+
- name: Approve Dependabot PR
2234
run: gh pr review --approve "$PR_URL"
2335
env:
2436
PR_URL: ${{ github.event.pull_request.html_url }}
2537
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2638

27-
- name: Enable auto-merge
39+
# 4) Enable auto-merge for safe updates (patch + minor).
40+
# Adjust the condition if you want patch-only or include majors.
41+
- name: Enable auto-merge (patch/minor)
2842
if: |
2943
steps.metadata.outputs.update-type == 'version-update:semver-patch' ||
3044
steps.metadata.outputs.update-type == 'version-update:semver-minor'

0 commit comments

Comments
 (0)