-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (85 loc) · 2.59 KB
/
auto-approve-merge-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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: auto approve + merge dependabot prs
on:
pull_request:
branches:
- main
types:
- labeled
- synchronize
check_suite:
types:
- completed
status: {}
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v3
auto-approve:
name: Auto approve Dependabot PRs
runs-on: ubuntu-latest
permissions:
pull-requests: write
needs: debug
if: |
(
github.event.pull_request.user.login == 'dependabot[bot]' ||
github.event.pull_request.user.login == 'dependabot' ||
github.event.pull_request.user.login == 'dependabot-preview[bot]' ||
github.event.pull_request.user.login == 'dependabot-preview'
) && (
github.actor == 'dependabot[bot]' ||
github.actor == 'dependabot' ||
github.actor == 'dependabot-preview[bot]' ||
github.actor == 'dependabot-preview'
)
steps:
- uses: hmarr/auto-approve-action@v4.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
auto-merge:
name: Auto merge Dependabot PRs
runs-on: ubuntu-latest
permissions:
checks: read
contents: write
pull-requests: write
statuses: read
needs: auto-approve
if: |
github.actor == 'dependabot[bot]' ||
github.actor == 'dependabot' ||
github.actor == 'dependabot-preview[bot]' ||
github.actor == 'dependabot-preview'
steps:
- name: Retrieve Dependabot metadata
id: dependabot-metadata
uses: "dependabot/fetch-metadata@v2.1.0"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Wait for status checks
id: wait-for-status-checks
uses: "wyrihaximus/github-action-wait-for-status@v1.8.0"
with:
ignoreActions: "Auto merge Dependabot PRs"
checkInterval: 30
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Auto merge
if: |
steps.wait-for-status-checks.outputs.status == 'success' &&
steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
id: automerge
uses: "pascalgn/automerge-action@v0.16.3"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "automerge,!major"
MERGE_REMOVE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "pull-request-title-and-description"
MERGE_FORKS: "false"
MERGE_RETRIES: "6"
MERGE_RETRY_SLEEP: "30000"
MERGE_REQUIRED_APPROVALS: "1"
UPDATE_METHOD: "rebase"