Skip to content

Commit d65b002

Browse files
chore(ci): add auto-merge for dependabot PR (#49)
* chore(ci): add auto-merge for dependabot pr * chore(ci): add dependabot job name
1 parent 55a1893 commit d65b002

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
name: Cargo Build & Test
2-
32
on:
43
push:
54
pull_request:
65
workflow_dispatch:
7-
86
env:
97
CARGO_TERM_COLOR: always
10-
118
jobs:
12-
build_and_test:
9+
build-and-test:
1310
name: Build & Test
1411
runs-on: ubuntu-latest
1512
strategy:
@@ -31,7 +28,6 @@ jobs:
3128
- run: cargo check-all-features -- --verbose
3229
- run: cargo build-all-features -- --verbose
3330
- run: cargo test-all-features -- --verbose
34-
3531
rustfmt:
3632
name: Check Format
3733
runs-on: ubuntu-latest
@@ -42,8 +38,7 @@ jobs:
4238
- run: rustup update stable && rustup default stable
4339
- run: rustup component add rustfmt
4440
- run: cargo fmt --all --check
45-
46-
build_docs:
41+
docs:
4742
name: Docs
4843
runs-on: ubuntu-latest
4944
steps:
@@ -52,3 +47,22 @@ jobs:
5247
fetch-depth: 0
5348
- run: rustup update nightly && rustup default nightly
5449
- run: cargo +nightly doc --all-features --no-deps
50+
dependabot:
51+
name: Dependabot Auto-merge
52+
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
53+
needs: [build-and-test, rustfmt, docs]
54+
runs-on: ubuntu-latest
55+
permissions:
56+
pull-requests: write
57+
contents: write
58+
steps:
59+
- id: metadata
60+
uses: dependabot/fetch-metadata@v2
61+
with:
62+
github-token: "${{ secrets.GITHUB_TOKEN }}"
63+
- run: |
64+
gh pr review --approve "$PR_URL"
65+
gh pr merge --squash --auto "$PR_URL"
66+
env:
67+
PR_URL: ${{github.event.pull_request.html_url}}
68+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)