-
Notifications
You must be signed in to change notification settings - Fork 1
/
auto-approve-merge-dependabot.yml
81 lines (79 loc) · 2.56 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
name: auto approve + merge dependabot prs
on:
pull_request_target:
branches:
- main
types:
- labeled
- synchronize
check_suite:
types:
- completed
status: {}
jobs:
auto-approve:
name: Auto approve Dependabot PRs
runs-on: ubuntu-latest
permissions:
pull-requests: write
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/[email protected]
with:
github-token: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
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/[email protected]"
with:
github-token: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
- name: Wait for status checks
id: wait-for-status-checks
uses: "wyrihaximus/[email protected]"
with:
ignoreActions: "Auto merge Dependabot PRs"
checkInterval: 30
env:
GITHUB_TOKEN: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
- 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/[email protected]"
env:
GITHUB_TOKEN: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
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"