-
Notifications
You must be signed in to change notification settings - Fork 2.3k
37 lines (35 loc) · 1.31 KB
/
dependabot-merge.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
name: Dependabot Merge Me!
on:
pull_request_target:
branches: [ master, next ]
jobs:
merge-me:
name: Merge me!
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
# This first step will fail if there's no metadata and so the approval
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Here the PR gets approved.
- name: Approve a PR
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
# Finally, tell dependabot to merge the PR if all checks are successful
- name: Instruct dependabot to squash & merge
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
allow-repeats: true
message: |
@dependabot squash and merge
env:
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}