-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1.35 KB
/
dependabot-auto-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
38
39
40
41
42
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request
# https://github.com/dependabot/fetch-metadata/#enabling-auto-merge
name: Dependabot auto-merge
on: pull_request_target
permissions:
contents: write
pull-requests: write
defaults:
run:
shell: bash
jobs:
dependabot:
if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1 # https://github.com/dependabot/fetch-metadata/
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: |
${{
(
steps.dependabot-metadata.outputs.package-ecosystem == 'github-actions' &&
steps.metadata.outputs.update-type == 'version-update:semver-major'
) || (
steps.dependabot-metadata.outputs.package-ecosystem == 'maven' &&
steps.metadata.outputs.update-type == 'version-update:semver-minor'
)
}}
run: |
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}