Skip to content

Commit a08bd0f

Browse files
authored
Add auto-merge dependabot workflow (#26)
1 parent 2c8e6ba commit a08bd0f

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Dependabot Auto-Merge
2+
3+
# Enables auto-merge on Dependabot PRs for minor and patch updates. The PR merges once
4+
# required status checks pass. Needs "Allow auto-merge" enabled in the repo settings.
5+
6+
on:
7+
pull_request:
8+
types: [ opened, reopened, synchronize ]
9+
10+
permissions: {}
11+
12+
jobs:
13+
auto-merge:
14+
if: github.event.pull_request.user.login == 'dependabot[bot]'
15+
runs-on: ubuntu-slim
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
steps:
20+
- name: Fetch Dependabot metadata
21+
id: metadata
22+
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
23+
24+
- name: Enable auto-merge
25+
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
26+
env:
27+
GH_TOKEN: ${{ github.token }}
28+
PR_URL: ${{ github.event.pull_request.html_url }}
29+
run: |
30+
gh pr merge --auto --squash "$PR_URL"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Dependabot Auto-Merge
2+
3+
# Enables auto-merge on Dependabot PRs for minor and patch updates. The PR merges once
4+
# required status checks pass. Needs "Allow auto-merge" enabled in the repo settings.
5+
6+
on:
7+
pull_request:
8+
types: [ opened, reopened, synchronize ]
9+
10+
permissions: {}
11+
12+
jobs:
13+
auto-merge:
14+
if: github.event.pull_request.user.login == 'dependabot[bot]'
15+
runs-on: ubuntu-slim
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
steps:
20+
- name: Fetch Dependabot metadata
21+
id: metadata
22+
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
23+
24+
- name: Enable auto-merge
25+
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
26+
env:
27+
GH_TOKEN: ${{ github.token }}
28+
PR_URL: ${{ github.event.pull_request.html_url }}
29+
run: |
30+
gh pr merge --auto --squash "$PR_URL"

0 commit comments

Comments
 (0)