-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmergify.yml
246 lines (228 loc) · 8 KB
/
mergify.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
pull_request_rules:
# ===============================================================================
# DEPENDABOT
# ===============================================================================
- name: Automatic Merge for Dependabot Minor Version Pull Requests
conditions:
- -draft
- author~=^dependabot(|-preview)\[bot\]$
- check-success='build (1.16.x, ubuntu-latest)'
- check-success='build (1.17.x, ubuntu-latest)'
- check-success='build (1.16.x, macos-latest)'
- check-success='build (1.17.x, macos-latest)'
- check-success='lint (1.16.x, ubuntu-latest)'
- check-success='lint (1.17.x, ubuntu-latest)'
- check-success='lint (1.16.x, macos-latest)'
- check-success='lint (1.17.x, macos-latest)'
- check-success='Analyze (go)'
- title~=^Bump [^\s]+ from ([\d]+)\..+ to \1\.
actions:
review:
type: APPROVE
message: Automatically approving dependabot pull request
merge:
method: squash
- name: Alert on major version detection
conditions:
- author~=^dependabot(|-preview)\[bot\]$
- check-success='build (1.16.x, ubuntu-latest)'
- check-success='build (1.17.x, ubuntu-latest)'
- check-success='build (1.16.x, macos-latest)'
- check-success='build (1.17.x, macos-latest)'
- check-success='lint (1.16.x, ubuntu-latest)'
- check-success='lint (1.17.x, ubuntu-latest)'
- check-success='lint (1.16.x, macos-latest)'
- check-success='lint (1.17.x, macos-latest)'
- check-success='Analyze (go)'
- -title~=^Bump [^\s]+ from ([\d]+)\..+ to \1\.
actions:
comment:
message: "⚠️ @theflyingcodr @jadwahab: this is a major version bump and requires your attention"
# ===============================================================================
# AUTOMATIC MERGE (APPROVALS)
# ===============================================================================
- name: Automatic Merge ⬇️ on Approval ✔
conditions:
- "#approved-reviews-by>=1"
- check-success='build (1.16.x, ubuntu-latest)'
- check-success='build (1.17.x, ubuntu-latest)'
- check-success='build (1.16.x, macos-latest)'
- check-success='build (1.17.x, macos-latest)'
- check-success='lint (1.16.x, ubuntu-latest)'
- check-success='lint (1.17.x, ubuntu-latest)'
- check-success='lint (1.16.x, macos-latest)'
- check-success='lint (1.17.x, macos-latest)'
- check-success='Analyze (go)'
- label!=work-in-progress
- -draft
actions:
merge:
method: squash
# ===============================================================================
# AUTHOR
# ===============================================================================
- name: Auto-Assign Author
conditions:
- "#assignee=0"
actions:
assign:
add_users:
- "{{author}}"
# ===============================================================================
# ALERTS
# ===============================================================================
- name: Notify on merge
conditions:
- merged
- label=automerge
actions:
comment:
message: "✅ @{{author}}: **{{title}}** has been merged successfully."
- name: Alert on merge conflict
conditions:
- conflict
- label=automerge
actions:
comment:
message: "🆘 @{{author}}: `{{head}}` has conflicts with `{{base}}` that must be resolved."
label:
add:
- conflict
- name: Alert on tests failure for automerge
conditions:
- label=automerge
- status-failure=commit
actions:
comment:
message: "🆘 @{{author}}: unable to merge due to CI failure."
- name: remove conflict label if not needed
conditions:
- -conflict
actions:
label:
remove:
- conflict
# ===============================================================================
# LABELS
# ===============================================================================
# Automatically add labels when PRs match certain patterns
#
# NOTE:
# - single quotes for regex to avoid accidental escapes
# - Mergify leverages Python regular expressions to match rules.
#
# Semantic commit messages
# - chore: updating grunt tasks etc.; no production code change
# - docs: changes to the documentation
# - feat: feature or story
# - enhancement: an improvement to an existing feature
# - feat: new feature for the user, not a new feature for build script
# - fix: bug fix for the user, not a fix to a build script
# - idea: general idea or suggestion
# - test: test related changes
# ===============================================================================
- name: Hotfix label
conditions:
- "head~=(?i)^hotfix" # if the PR branch starts with hotfix/
actions:
label:
add: ["hot-fix"]
- name: Bug / Fix label
conditions:
- "head~=(?i)^(bug)?fix" # if the PR branch starts with (bug)?fix/
actions:
label:
add: [ "bug-P3" ]
- name: Documentation label
conditions:
- "head~=(?i)^docs" # if the PR branch starts with docs/
actions:
label:
add: [ "documentation" ]
- name: Feature label
conditions:
- "head~=(?i)^feat(ure)?" # if the PR branch starts with feat(ure)?/
actions:
label:
add: ["feature"]
- name: Enhancement label
conditions:
- "head~=(?i)^enhancement?" # if the PR branch starts with enhancement/
actions:
label:
add: ["enhancement"]
- name: Chore label
conditions:
- "head~=(?i)^chore" # if the PR branch starts with chore/
actions:
label:
add: ["update"]
- name: Question label
conditions:
- "head~=(?i)^question" # if the PR branch starts with question/
actions:
label:
add: ["question"]
- name: Test label
conditions:
- "head~=(?i)^test" # if the PR branch starts with test/
actions:
label:
add: ["test"]
- name: Idea label
conditions:
- "head~=(?i)^idea" # if the PR branch starts with idea/
actions:
label:
add: ["idea"]
# ===============================================================================
# STALE BRANCHES
# ===============================================================================
- name: Close stale pull request
conditions:
- or:
- base=master
- base=v1
- -closed
- updated-at<21 days ago
actions:
close:
message: |
This pull request looks stale. Feel free to reopen it if you think it's a mistake.
label:
add: [ "stale" ]
# ===============================================================================
# BRANCHES
# ===============================================================================
- name: Delete head branch after merge
conditions:
- merged
actions:
delete_head_branch:
#- name: automatic update for PR marked as “Ready-to-Go“
# conditions:
# - -conflict # skip PRs with conflicts
# - -draft # filter-out GH draft PRs
# - label="Ready-to-Go"
# actions:
# update:
# ===============================================================================
# CONVENTION
# ===============================================================================
# https://www.conventionalcommits.org/en/v1.0.0/
# Premium feature only
#- name: Conventional Commit
# conditions:
# - "title~=^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\\(.+\\))?:"
# actions:
# post_check:
# title: |
# {% if check_succeed %}
# Title follows Conventional Commit
# {% else %}
# Title does not follow Conventional Commit
# {% endif %}
# summary: |
# {% if not check_succeed %}
# Your pull request title must follow [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/).
# {% endif %}