-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathschema.json
More file actions
459 lines (459 loc) · 19 KB
/
schema.json
File metadata and controls
459 lines (459 loc) · 19 KB
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
{
"$schema": "http://json-schema.org/draft-07/schema",
"$comment": "https://docs.reviewpad.com/docs",
"definitions": {
"import": {
"type": "object",
"properties": {
"url": {
"description": "Url to another reviewpad.yml configuration file.",
"type": "string",
"pattern": "\\.(yml|yaml)$",
"examples": [
"./path/to/reviewpad.yml",
"https://path.com/to/reviewpad.yml"
]
}
}
},
"extendedFile": {
"type": "string",
"description": "Url of a GitHub blob that represents another reviewpad.yml configuration file.",
"pattern": "((https|http):\\/\\/)?github\\.com\\/[^ \"]+\\/[^ \"]+\\/blob\\/[^ \"]+(\\/[^ \"]+)?\\/[^ \"]+.(yml|yaml)$",
"examples": [
"https://github.com/reviewpad/.github/blob/main/reviewpad-models/common.yml",
"https://github.com/reviewpad/reviewpad/blob/main/reviewpad.yml"
]
},
"action": {
"description": "Action to run. This action needs to be an aladino built-in function.",
"type": "string",
"pattern": "^\\$[a-zA-Z_][a-zA-Z0-9_-]*\\((.|\\s)*(,(.|\\s)*)*\\)$",
"examples": [
"$addLabel(\"large\")",
"$addToProject(\"reviewpad\", \"in progress\")",
"$assignAssignees([\"john\", \"marie\", \"peter\"])",
"$assignRandomReviewer()",
"$assignReviewer([\"john\"])",
"$assignReviewer($team(\"devops\"), 3)",
"$assignTeamReviewer([\"core\", \"support\"])",
"$close()",
"$comment(\"This pull request has git conflicts. Please resolve them.\")",
"$commentOnce(\"This is your first contribution! Thank you!\")",
"$commitLint()",
"$deleteHeadBranch()",
"$disableActions([\"assignReviewer\"])",
"$error(\"Please do not touch these files.\")",
"$fail(\"Missing specs\")",
"$info(\"Please do not forget to add the tests.\")",
"$merge(\"rebase\")",
"$removeLabel(\"medium\")",
"$removeLabels([\"bug\", \"p1\"])",
"$review(\"REQUEST_CHANGES\", \"Please include the tests for your change\")",
"$setProjectField(\"jupiter\", \"notes\", \"missing issue\")",
"$triggerWorkflow(\"main.yml\")",
"$warn(\"Please do not forget to add the tests.\")"
]
},
"label": {
"description": "A label is used to sort and describe pull requests.",
"type": "object",
"properties": {
"name": {
"description": "The name of the label.",
"type": "string"
},
"description": {
"description": "A short description of the label. Must be 100 characters or fewer.",
"type": "string"
},
"color": {
"description": "The hexadecimal color code for the label, with or without the leading #.",
"type": "string",
"examples": [
"#8a2151",
"d2697a"
]
}
},
"additionalProperties": false
},
"rule": {
"description": "A rule specifies a filter over a pull request.",
"type": "object",
"properties": {
"name": {
"description": "The name of the rule that is used to identify the rule.",
"type": "string"
},
"description": {
"description": "The description can be used to provide more details about the rule.",
"type": "string"
},
"kind": {
"description": "The kind of a rule. The kind is related to different properties of pull requests that will be used in the evaluation of the 'spec' field.",
"type": "string",
"enum": [
"patch",
"author"
]
},
"spec": {
"description": "The spec is a boolean expression in a domain specific language called Aladino (Portuguese translation of Aladdin).",
"type": "string",
"examples": [
"$any($reviewers(), ($r: String => $reviewerStatus($r) == \"APPROVED\"))",
"$approvalsCount() > 2",
"$assignees() == [\"john\"]",
"$author() == \"john\"",
"$base() == \"stage\"",
"$changed(\"src/@1.java\", \"test/@1.java\")",
"$checkRunConclusion(\"build\") == \"success\"",
"$comment(\"Missing tests\")",
"$contains($title(), \"bug\")",
"$fileCount() > 5",
"$hasGitConflicts()",
"$hasAnnotation(\"critical\")",
"$hasCodePattern(\"placeBet\\(.*\\)\")",
"$hasFileExtensions([\".test.ts\"])",
"$hasFileName(\"main.js\")",
"$hasLinearHistory()",
"$hasLinkedIssues()",
"$hasRequiredApprovals(2, [\"john\", \"jane\", \"peter\"])",
"$isBinary(\"folder/filename\")",
"$isDraft()",
"$isElementOf($author(), $team(\"devops\"))",
"$join([\"alice\", \"bob\"], \" \") ",
"$labels() == [\"feat\"]",
"$reviewers() != []",
"$selectFromJSON($toJSON(\"[1, 2, 3]\"), \"$[0]\")",
"$selectFromContext(\"$.title\")",
"$size() > 100",
"$toBool(\"true\")"
]
}
},
"required": [
"name",
"spec"
],
"additionalProperties": false
},
"entityType": {
"description": "GitHub entity type that should trigger the workflow",
"type": "string",
"enum": [
"pull_request",
"issue"
]
},
"workflow": {
"description": "A workflow specifies a set of rules that need to be met in order to run a defined set of actions.",
"type": "object",
"properties": {
"name": {
"description": "The workflow name.",
"type": "string"
},
"description": {
"description": "The description can be used to provide more details about the workflow.",
"type": "string"
},
"on": {
"description": "List of GitHub entity types that should trigger the workflow. By default, the value is pull_request.",
"type": "array",
"items": {
"$ref": "#/definitions/entityType"
}
},
"run": {
"description": "The set of actions to be executed for a workflow, can be a single action, a list of actions, a conditional or a combination of all.",
"type": [
"array"
],
"minItems": 1,
"items": {
"$ref": "#/definitions/condition-action"
}
}
},
"required": [
"name",
"run"
],
"additionalProperties": false
},
"stage": {
"description": "A stage is a list of actions that will execute until the `until` condition is true.",
"type": "object",
"properties": {
"actions": {
"description": "The set of actions to be executed while the evaluation of the rule specified in the until clause is false.",
"type": "array",
"items": {
"$ref": "#/definitions/action"
},
"minItems": 1
},
"until": {
"description": "The rule to be met in order for the execution of the set of actions to stop.",
"type": "string"
}
},
"required": [
"actions"
],
"additionalProperties": false
},
"pipeline": {
"description": "A pipeline specifies a set of stages where each contains a set of actions to execute while the until clause evaluation is false. A pipeline only runs if it is triggered.",
"type": "object",
"properties": {
"name": {
"description": "The pipeline name.",
"type": "string"
},
"description": {
"description": "The description can be used to provide more details about the pipeline.",
"type": "string"
},
"trigger": {
"description": "A pipeline is running if and only if the trigger is empty or the rule that is specified in it is true.",
"type": "string"
},
"stages": {
"type": "array",
"description": "List of stages of the pipeline. Each stage is a list of actions to be executed while the `until` condition is evaluated to false.",
"items": {
"$ref": "#/definitions/stage"
},
"minItems": 1
}
},
"required": [
"name",
"stages"
],
"additionalProperties": false
},
"groupBasic": {
"description": "A group specifies a set of users in the repository where the workflow runs.",
"type": "object",
"properties": {
"name": {
"description": "The name of the group that is used to identify the group.",
"type": "string"
},
"description": {
"description": "The description can be used to provide more details about the group.",
"type": "string"
},
"kind": {
"description": "The kind of a group.",
"type": "string",
"enum": [
"developers"
]
},
"spec": {
"description": "The spec is an expression in a domain specific language called Aladino (Portuguese translation of Aladdin) that is evaluated to an array of users.",
"type": "string",
"examples": [
"'[\"john\", \"jane\"]'"
]
}
},
"required": [
"name",
"spec"
],
"additionalProperties": false
},
"groupWithType": {
"description": "A group specifies a set of users in the repository where the workflow runs.",
"type": "object",
"properties": {
"name": {
"description": "The name of the group that is used to identify the group.",
"type": "string"
},
"description": {
"description": "The description can be used to provide more details about the group.",
"type": "string"
},
"kind": {
"description": "The kind of a group.",
"type": "string",
"enum": [
"developers"
]
},
"type": {
"description": "The type of a group. Represents the type function to the applied to the group.",
"type": "string",
"enum": [
"filter"
]
},
"param": {
"description": "The 'param' describes the parameter name to be used on the 'spec' expression.",
"type": "string",
"examples": [
"$dev"
]
},
"where": {
"description": "The 'where' is an expression in a domain specific language called Aladino (Portuguese translation of Aladdin) that is evaluated to an array of users.",
"type": "string",
"examples": [
"$pullRequestCountBy($dev,\"all\") < 10"
]
}
},
"required": [
"name",
"kind",
"type",
"param",
"where"
],
"additionalProperties": false
},
"condition-action": {
"anyOf": [
{
"type": "object",
"properties": {
"if": {
"type": "string",
"minLength": 1
},
"then": {
"type": [
"string",
"array"
],
"minItems": 1,
"items": {
"$ref": "#/definitions/condition-action"
}
},
"else": {
"type": [
"string",
"array"
],
"minItems": 1,
"items": {
"$ref": "#/definitions/condition-action"
}
}
},
"additionalProperties": false,
"required": [
"if",
"then"
]
},
{
"type": [
"string",
"array"
],
"minItems": 1,
"items": {
"$ref": "#/definitions/condition-action"
}
}
]
}
},
"properties": {
"mode": {
"description": "The mode in which Reviewpad will run. 'verbose' to add a comment on the pull request with the triggered workflows. 'silent' to run without any comment. By default, the mode is 'silent'.",
"type": "string",
"enum": [
"silent",
"verbose"
]
},
"ignore-errors": {
"description": "Specifies if Reviewpad should ignore execution errors. By default, this flag is 'false' which means that Reviewpad will fail if an error is raised.",
"type": "boolean"
},
"metrics-on-merge": {
"description": "Specifies if Reviewpad should add a metrics report when the pull request is merged. By default, this flag is 'false' which means that Reviewpad will not add this report.",
"type": "boolean"
},
"imports": {
"description": "List of imports to be loaded. This is used in order to allow split configuration files and use them across different projects.",
"type": "array",
"items": {
"$ref": "#/definitions/import"
},
"minItems": 1
},
"extends": {
"description": "List of other Reviewpad configuration files as GitHub blob URLs. This allows the ability to share common specifications for all the flags, labels, rules, and workflows from multiple GitHub repositories with the possibility to override the inherited configurations.",
"type": "array",
"items": {
"$ref": "#/definitions/extendedFile"
},
"minItems": 1
},
"labels": {
"description": "List of labels to be used. Labels that do not exist in the project will be created using the provided color and description.",
"type": "object",
"patternProperties": {
"^[_a-zA-Z][a-zA-Z0-9_-]*$": {
"$ref": "#/definitions/label"
}
},
"minProperties": 1,
"additionalProperties": false
},
"rules": {
"description": "List of rules that will be used in the workflows. All rules defined here should be used, otherwise, an error will be triggered.",
"type": "array",
"items": {
"$ref": "#/definitions/rule"
},
"minItems": 1,
"additionalProperties": false
},
"workflows": {
"description": "List of workflows. A workflow is tested against the selected rules and if all rules evaluate to true, then all defined actions run.",
"type": "array",
"items": {
"$ref": "#/definitions/workflow"
},
"minItems": 1
},
"groups": {
"description": "List of groups. A group corresponds to a set of users in the repo where the pull request occurs.",
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/definitions/groupBasic"
},
{
"$ref": "#/definitions/groupWithType"
}
]
},
"minItems": 1,
"additionalProperties": false
},
"pipelines": {
"description": "List of pipelines. A pipeline specifies a set of stages where each contains a set of actions to execute while the until clause evaluation is false. A pipeline only runs if it is triggered.",
"type": "array",
"items": {
"$ref": "#/definitions/pipeline"
},
"minItems": 1
},
"additionalProperties": false
},
"additionalProperties": false
}