-
Notifications
You must be signed in to change notification settings - Fork 21
33 lines (31 loc) · 1.4 KB
/
dependabot-auto-approve.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
# Automatically approves pull requests if:
# 1. The PR was opened by Dependabot
# 2. The dependency's semantic versioning change is either minor or patch (not major)
name: Dependabot auto-approve
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
- name: Approve a PR if dependency semver changes are minor or patch
if: ${{contains(fromJson('["version-update:semver-patch", "version-update:semver-minor"]'), steps.dependabot-metadata.outputs.update-type)}}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge if dependency semver changes are minor or patch
if: ${{contains(fromJson('["version-update:semver-patch", "version-update:semver-minor"]'), steps.dependabot-metadata.outputs.update-type)}}
run: |
echo "Enabling auto-merge for Dependabot $UPDATE_TYPE"
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
UPDATE_TYPE: ${{steps.dependabot-metadata.outputs.update-type}}