Skip to content

Commit 8d479c0

Browse files
mesh-2092: add auto merge workflow
1 parent cf7e25b commit 8d479c0

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Auto-merge Dependabot PRs
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- ready_for_review
10+
- labeled
11+
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
jobs:
17+
dependabot-make-update:
18+
# Only run on Dependabot PRs
19+
if: github.event.pull_request.user.login == 'dependabot[bot]'
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Install Python 3.11
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: '3.11'
32+
33+
- name: Install poetry
34+
run: python -m pip install --upgrade pip setuptools wheel poetry
35+
36+
- name: Install project dependencies
37+
run: make install-ci
38+
39+
- name: Update dependencies (make update)
40+
run: make update
41+
42+
- name: Lint (make lint)
43+
run: make lint
44+
45+
enable-automerge:
46+
# Only run on Dependabot PRs after make update succeeds
47+
if: github.event.pull_request.user.login == 'dependabot[bot]'
48+
needs: dependabot-make-update
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- name: Fetch Dependabot metadata
53+
id: metadata
54+
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
55+
with:
56+
github-token: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Enable auto-merge for Dependabot PRs
59+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
60+
run: gh pr merge --auto --squash "$PR_URL"
61+
env:
62+
PR_URL: ${{ github.event.pull_request.html_url }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)