Skip to content

Commit ba92bf9

Browse files
committed
chore: add a workflow to automate the Dependabot PRs
1 parent b326c32 commit ba92bf9

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow attempts to automate the Dependabot PRs. Everything here is still WIP and
2+
# hence is subject to change!
3+
4+
# The following source of documentation has been used to modify the contents of this file:
5+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
6+
name: Dependabot Auto-Merge
7+
8+
on:
9+
pull_request:
10+
types:
11+
- opened
12+
- synchronize
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
dependabot:
20+
name: Dependabot
21+
runs-on: ubuntu-latest
22+
if: github.event.pull_request.user.login == 'dependabot[bot]'
23+
steps:
24+
- name: Fetch Dependabot Metadata
25+
id: metadata
26+
uses: dependabot/fetch-metadata@v2.2.0
27+
with:
28+
github-token: "${{ secrets.GITHUB_TOKEN }}"
29+
30+
- name: Enable Auto-Merge
31+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
32+
env:
33+
PR_URL: ${{github.event.pull_request.html_url}}
34+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
35+
run: gh pr merge --auto --merge "$PR_URL"
36+
37+
- name: Auto Approve Pull Request
38+
if: github.event.pull_request.user.login == 'dependabot[bot]'
39+
env:
40+
PR_URL: ${{github.event.pull_request.html_url}}
41+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
42+
run: gh pr review --approve "$PR_URL"

0 commit comments

Comments
 (0)