This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
reviewpad.yml
241 lines (207 loc) · 7 KB
/
reviewpad.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
api-version: reviewpad.com/v2.x
mode: silent
edition: professional
labels:
small:
description: Small changes
# color is the hexadecimal color code for the label, without the leading #.
color: "294b69"
medium:
description: Medium changes
color: "a8c3f7"
large:
description: Large changes
color: "8a2138"
external-contribution:
description: External contribution
color: "8a2151"
critical:
description: Modifications to critical changes
color: "294b75"
ship:
description: Ship mode
color: "76dbbe"
groups:
- name: owners
description: Group of owners
kind: developers
spec: '["marcelosousa", "ferreiratiago"]'
- name: plugins-reviewers
description: Group of plugin reviewers
kind: developers
spec: '["marcelosousa", "ferreiratiago", "shay2025"]'
- name: maintainers
description: Official maintainers
kind: developers
spec: '["marcelosousa", "ferreiratiago"]'
- name: rising-stars
description: Rising stars in the team
kind: developers
spec: '["shay2025"]'
- name: official-contributors
description: Reviewpad core contributors
kind: developers
spec: '$append($group("maintainers"), $group("rising-stars"))'
rules:
- name: tautology
kind: patch
description: always true
spec: 'true'
- name: is-small
kind: patch
description: small pull request
spec: $size() <= 30
- name: is-medium
kind: patch
description: medium-sized pull request
spec: $size() > 30 && $size() <= 100
- name: is-large
kind: patch
description: large-sized pull request
spec: $size() > 100
- name: changes-are-in-markdown
kind: patch
description: Verifies if changes are only in markdown files
spec: '$hasFileExtensions([".md"])'
- name: changes-should-be-built
kind: patch
description: Verifies if changes are not only in markdown files
spec: '!$rule("changes-are-in-markdown")'
- name: ci-is-green
kind: patch
description: Pipeline is green
spec: '$workflowStatus("pr-build") == "success" && $workflowStatus("reviewpad") == "success"'
- name: shipPullRequestsAreAutomerged
kind: patch
description: owners of pull requests with ship in the title
spec: '$contains($description(), "[x] Ship:") && $isElementOf($author(), $group("owners")) && $rule("ci-is-green")'
- name: shipSimplePullRequests
kind: patch
description: owners can ship simple pull requests
spec: '$contains($description(), "[x] Ship:") && $isElementOf($author(), $group("owners")) && $rule("changes-are-in-markdown")'
- name: is-first-time-contributor
kind: patch
description: First pull request created
spec: '$totalCreatedPullRequests($author()) == 1'
- name: touchesLicense
kind: patch
description: modifies the LICENSE file
spec: '$hasFileName("LICENSE")'
- name: touchesMoreThanLicense
kind: patch
description: modifies the LICENSE file and other files
spec: '$rule("touchesLicense") && $fileCount() > 1'
- name: touchesLicenseByNonOwner
kind: patch
description: non-owner modifies the LICENSE file
spec: '$rule("touchesLicense") && !$isElementOf($author(), $group("owners"))'
- name: changes-critical-functions
kind: patch
description: Changes to functions considered critical
# This spec uses a special built-in that understand which functions were commented
# with "reviewpad-an: critical"
spec: '$hasAnnotation("critical")'
- name: changes-to-main-file
description: Changes to the main file
kind: patch
spec: '$hasFileName("main.go")'
- name: does-not-have-linear-history
kind: patch
description: Pull request does not have a linear history
spec: '!$hasLinearHistory()'
- name: authored-by-rising-stars
kind: patch
description: Pull request was authored by rising stars
spec: '$isElementOf($author(), $group("rising-stars"))'
- name: authored-by-maintainers
kind: patch
description: Pull request was authored by maintainers
spec: '$isElementOf($author(), $group("maintainers"))'
- name: authored-by-external-contributors
kind: patch
description: Pull request was authored by external contributors
spec: '!$isElementOf($author(), $group("official-contributors"))'
workflows:
- name: add-label-with-size
description: Add label with size of the pull request
always-run: true
if:
- rule: is-small
extra-actions:
- '$addLabel("small")'
- rule: is-medium
extra-actions:
- '$addLabel("medium")'
- rule: is-large
extra-actions:
- '$addLabel("large")'
- name: lint-commits
description: Lint commits
always-run: true
if:
- rule: does-not-have-linear-history
extra-actions:
- '$warn("This pull request does not have linear history - please fix this!")'
- rule: tautology
extra-actions:
- '$commitLint()'
- name: unauthorized-license-workflow
description: Protect unauthorized modifications to the LICENSE
if:
- rule: touchesLicenseByNonOwner
then:
- '$error("Sorry, you are not authorized to make these changes")'
- '$close()'
- name: license-workflow
description: Protect modifications to the LICENSE
if:
- rule: touchesLicense
- rule: touchesMoreThanLicense
extra-actions:
- '$warn("This pull request should only modify the LICENSE!")'
then:
- '$addLabel("modifies-license")'
- '$assignReviewer($group("owners"), 1)'
- name: add-label-for-build
description: Add label to kick in the build
always-run: true
if:
- rule: changes-should-be-built
then:
- '$addLabel("run-build")'
- name: auto-merge-owner-pull-requests
description: auto merge pull requests
if:
- rule: shipPullRequestsAreAutomerged
- rule: shipSimplePullRequests
then:
- '$addLabel("ship")'
- '$merge("rebase")'
- name: changes-to-critical-code
description: changes to critical code
always-run: true
if:
- rule: changes-critical-functions
- rule: changes-to-main-file
then:
- '$addLabel("critical")'
- '$assignReviewer($group("owners"), 1)'
- '$info("@marcelosousa: you are being notified because critical code was modified")'
- name: default-review-process
description: default review process
# only runs if the pull request is not automatically merged
if:
- rule: is-first-time-contributor
extra-actions:
- '$commentOnce("Thank you so much for your first contribution!")'
- rule: authored-by-rising-stars
extra-actions:
- '$assignReviewer($group("maintainers"))'
- rule: authored-by-maintainers
extra-actions:
- '$assignReviewer($group("maintainers"), 1)'
- '$assignReviewer($group("rising-stars"), 1)'
- rule: authored-by-external-contributors
extra-actions:
- '$addLabel("external-contribution")'
- '$assignReviewer($group("maintainers"), 1)'