You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added required score grouping to fellows reviews (#113)
Added new optional field to the config named `FellowScores` that has the
score of each fellow per dan. It was done as an object (and not a
collection) because it will never change in the foreseeable future
(added up to dan IX).
When the rule of type `fellows` has the optional field of
`minTotalScore` it will check that the score of the fellows who approved
the PR sums up to that number. If it doesn't sum to that number it will
fail with a custom error listing the score of each fellow for reference
(and saying how many points are missing).
Added `FellowMissingScoreFailure` class which handles the formatting of
errors when the score of fellows is not high enough.
This resolves#110
Downgraded JOI as there was a version mismatch that made the test fails.
This also updated the version to `2.4.0`
Copy file name to clipboardExpand all lines: README.md
+30-12Lines changed: 30 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -411,21 +411,37 @@ Meaning that if a user belongs to both `team-abc` and `team-example` their appro
411
411
412
412
This rule is useful when you need to make sure that at leasts two sets of eyes of two different teams review a Pull Request.
413
413
#### Fellows rule
414
-
The fellows rule has a slight difference to all of the rules:
414
+
The fellows rule requires an extra collection to be added to the configuration and distinguishes itself from the other rules with some new fields:
415
415
```yaml
416
-
- name: Fellows review
417
-
condition:
418
-
include:
419
-
- '.*'
420
-
exclude:
421
-
- 'example'
422
-
type: fellows
423
-
minRank: 2
424
-
minApprovals: 2
416
+
rules:
417
+
- name: Fellows review
418
+
condition:
419
+
include:
420
+
- '.*'
421
+
exclude:
422
+
- 'example'
423
+
type: fellows
424
+
minRank: 2
425
+
minApprovals: 2
426
+
minTotalScore: 4
427
+
scores:
428
+
dan1: 1
429
+
dan2: 2
430
+
dan3: 4
431
+
dan4: 8
432
+
dan5: 12
433
+
dan6: 15
434
+
dan7: 20
435
+
dan8: 25
436
+
dan9: 30
425
437
```
426
-
The biggest difference is that it doesn’t have a reviewers type (it doesn’t have a `teams` or `users` field); instead, it has a `minRank` field.
438
+
The biggest difference in the rule configuration is that it doesn’t have a reviewers type (it doesn’t have a `teams` or `users` field); instead, it has a `minRank` field and `minTotalScore` field.
439
+
440
+
The `minRank` field receives a number, which will be the lowest rank required to evaluate the PR, and then it fetches [all the fellows from the chain data](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama.api.onfinality.io%2Fpublic-ws#/fellowship), filters only the one to belong to that rank or above and then [looks into their metadata for a field name `github` and the handle there](https://github.com/polkadot-fellows/runtimes/issues/7).
441
+
442
+
The `minTotalScore` field relies on the `scores` collection. In this collection, each rank (dan) receives a score, so, in the example, a fellow dan 3 will have a score of 4. If the field `minTotalScore` is enabled, the conditions to approve a pull request, aside from requiring a given amount of reviews from a given rank, will be that _the total sum of all the scores from the fellows that have approved the pull request are equal or greater to the `minTotalScore` field_. This field is optional.
427
443
428
-
This field receives a number, which will be the lowest rank required to evaluate the PR, and then it fetches [all the fellows from the chain data](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama.api.onfinality.io%2Fpublic-ws#/fellowship), filters only the one to belong to that rank or above and then [looks into their metadata for a field name `github` and the handle there](https://github.com/polkadot-fellows/runtimes/issues/7).
444
+
For *every dan that has not been attributed a score, their score will default to 0*.
429
445
430
446
After this is done, the resulting handles will be treated like a normal list of required users.
431
447
@@ -439,6 +455,8 @@ It also has any other field from the [`basic rule`](#basic-rule) (with the excep
439
455
- **Optional**: Defaults to `false`.
440
456
- **minRank**: Must be a number.
441
457
- **Required**
458
+
- **minTotalScore**: Must be a number
459
+
- **Optional**: Defaults to 0.
442
460
443
461
##### Note
444
462
The fellows rule will never request reviewers, even if `request-reviewers` rule is enabled.
0 commit comments