forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.mergify.yml
233 lines (207 loc) · 7.49 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
#
# Copyright (c) 2020, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Mergify follow our workflow: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html
# Inital state (needs: review) is done by internal reviewer bot
# Notes: conditions do not check if label is already there if we add or remove later, this is to limit Github API access to
# minimum. If a label is already there and we add it again, nothing should happen (we do 1 less access to Github).
# For instance for needs: work if CI failed, we just add a label as action, don't check if needs: works is already there.
#
# Reviewers request needs write access to block PR, otherwise it's just a suggestion on Github, not PR block
pull_request_rules:
# From needs: review to needs: work - reviewers request
- name: "label needs: work when changes were requested"
conditions:
# Reviewers
- "#changes-requested-reviews-by>0"
actions:
label:
add: ['needs: work']
remove: ['needs: review', 'needs: CI']
# From needs: review to needs: work - CI failure
- name: "label needs: work when GitHub Actions jobs have failed"
conditions:
# GitHub Actions are failing
- check-failure=license-check
- check-failure=include-check
- check-failure=style-check
- check-failure=docs-check
- check-failure=python-tests
- check-failure=pin-validation
- check-failure=cmake-checks
- check-failure=frozen-tools-check
- "label!=mergify skip"
- "label!='needs: work'"
actions:
label:
add: ['needs: work']
remove: ['needs: review', 'needs: CI']
# From needs: CI to needs: work - CI failure in jenkins pipeline
- name: "label needs: work when Jenkins CI failed - pr head"
conditions:
# Jenkins CI failing, only pr head
- check-failure~=continuous-integration/jenkins/pr-head
- "label!=mergify skip"
- "label=needs: CI"
- -closed
actions:
label:
add: ['needs: work']
remove: ['needs: CI']
# From needs: CI to needs: work - CI failure
- name: "label needs: work when Jenkins CI failed - any of the pipeline"
conditions:
# Jenkins CI failing - any of the pipeline
- check-failure~=^jenkins-ci
- "label=needs: CI"
- "label!=mergify skip"
actions:
label:
add: ['needs: work']
remove: ['needs: CI']
# From needs: review or needs: work to needs: CI. One approval means we should be good to start CI
- name: "label needs: CI when at least one reviewers approval"
conditions:
# Labels
- "label!=needs: preceding PR"
# Reviewers
- "#changes-requested-reviews-by=0"
- "#approved-reviews-by>=1"
# No conflict with the base branch
- -conflict
# CI green policy, at least GitHub Actions jobs should be green
- check-success=license-check
- check-success=include-check
- check-success=style-check
- check-success=docs-check
- check-success=python-tests
- check-success=pin-validation
- check-success=cmake-checks
- check-success=frozen-tools-check
# new CI needs to be done (neutral does not work, lets check if it failed or passed, if none, we need to run again)
- -check-success~=continuous-integration/jenkins/pr-head
- -check-failure~=continuous-integration/jenkins/pr-head
actions:
label:
add: ['needs: CI']
remove: ['needs: review', 'needs: work']
# Remove reviews after the branch is updated. This yet does not allow
# any other action like labels, etc. See mergify-engine/issues/360
- name: remove outdated reviews
conditions: []
actions:
dismiss_reviews:
approved: True
changes_requested: True
# Conflict in the PR - needs: work and a comment to notify a user
- name: "label needs: work when there is a conflict"
conditions:
- -closed
- conflict
actions:
label:
add: ['needs: work']
remove: ['needs: review', 'needs: CI']
comment:
message: This PR cannot be merged due to conflicts. Please rebase to resolve them.
- name: "add label feature branch for feature branch additions"
conditions:
- base~=^feature
actions:
label:
add: ['release-version: feature branch']
# Ready for integration. Not yet auto merge, will be enabled once carefuly tested
- name: label "ready for merge" when ready
conditions:
# Labels
- "label!=do not merge"
- "label!=mergify skip"
- "label=needs: CI"
# Reviewers
- "#approved-reviews-by>=1"
- "#changes-requested-reviews-by=0"
# CI green policy
- check-success=license-check
- check-success=include-check
- check-success=style-check
- check-success=docs-check
- check-success=python-tests
- check-success=pin-validation
- check-success=cmake-checks
- check-success=frozen-tools-check
# Internal Jenkins - we rely on PR head to provide status
- check-success~=continuous-integration/jenkins/pr-head
# any of the jenkins pipeline needs to be green. We rely on not failure means all good (if skipped or executed)
- -check-failure~=^jenkins-ci
actions:
label:
add: ['ready for merge']
remove: ['needs: CI']
# Clean-up after merge
- name: remove ready for merge when merged
conditions:
- merged
- "label=ready for merge"
actions:
label:
remove: ['ready for merge', 'stale']
- name: add "do not merge" label when WIP is in title
conditions:
- title~=^(\[wip\]( |:) |\[WIP\]( |:) |wip( |:) |WIP( |:)).*
actions:
label:
add: ['do not merge']
# Check if version label is applied
- name: release version is a must for merged PRs part 1
conditions:
- merged
- -label~=^(release-version)
- -label~=^(Release review required)
- -label~=^(release-type)
actions:
label:
add: ['release version missing']
comment:
message: This PR does not contain release version label after merging.
# If there is a release version remove 'release version missing' and / or
# release review required
- name: release version is a must for merged PRs part 2.1
conditions:
- merged
- label=^(release-version)
actions:
label:
remove: ['release version missing', 'Release review required']
- name: release version is a must for merged PRs part 2.2
conditions:
- merged
- label=^(release-type)
actions:
label:
remove: ['release version missing', 'Release review required']
- name: add release review required to release branches
conditions:
- base~=^mbed-os-5.15
actions:
label:
add: ['Release review required']
# Clean-up if closed but not merged
- name: remove release version and needs labels
conditions:
- closed
- -merged
actions:
label:
remove_all: true