-
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 2.21 KB
/
dependabot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Dependabot Pull Request Approve & Merge
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
dependabot:
name: Dependabot
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Fetch Metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve PR
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor' }}
run: |
gh pr review --approve "${PR_URL}" -b "I'm **approving** this pull request because it includes a patch or minor update"
gh pr edit "${PR_URL}" --add-label "dependabot: auto approve"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto-Merge Non-Major Updates
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor' }}
run: |
gh pr comment "${PR_URL}" --body "I'm automatically merging this PR because it includes a patch or minor update"
gh pr merge --auto --squash --delete-branch "${PR_URL}"
gh pr edit "${PR_URL}" --add-label "dependabot: auto merge"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment & Label Major Updates
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' }}
run: |
gh pr comment "${PR_URL}" --body "I'm **NOT** automatically merging this PR because it includes a major update of a dependency"
gh pr edit "${PR_URL}" --add-label "dependabot: manual merge"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}