@@ -28,24 +28,29 @@ export function isAuthorAllowed(
28
28
return authorAssociations . includes ( pullRequestOrReview . author_association )
29
29
}
30
30
31
- export function isApprovedByAllowedAuthor ( review : Review , reviewAuthorAssociations : string [ ] ) : boolean {
32
- if ( ! isApproved ( review ) ) {
33
- core . debug ( `Review ${ review . id } is not an approval.` )
34
- return false
35
- }
36
-
37
- if ( ! isAuthorAllowed ( review , reviewAuthorAssociations ) ) {
31
+ export function isReviewAuthorAllowed ( review : Review , authorAssociations : string [ ] ) : boolean {
32
+ if ( ! isAuthorAllowed ( review , authorAssociations ) ) {
38
33
core . debug (
39
- `Review ${ review . id } is approved, however author @ ${ review . user ?. login } ` +
34
+ `Author @ ${ review . user ?. login } of review ${ review . id } ` +
40
35
`is ${ review . author_association } but must be one of the following:` +
41
- `${ reviewAuthorAssociations . join ( ', ' ) } `
36
+ `${ authorAssociations . join ( ', ' ) } `
42
37
)
38
+
43
39
return false
44
40
}
45
41
46
42
return true
47
43
}
48
44
45
+ export function isApprovedByAllowedAuthor ( review : Review , authorAssociations : string [ ] ) : boolean {
46
+ if ( ! isApproved ( review ) ) {
47
+ core . debug ( `Review ${ review . id } is not an approval.` )
48
+ return false
49
+ }
50
+
51
+ return isReviewAuthorAllowed ( review , authorAssociations )
52
+ }
53
+
49
54
export function relevantReviewsForCommit (
50
55
reviews : Review [ ] ,
51
56
reviewAuthorAssociations : string [ ] ,
@@ -60,15 +65,7 @@ export function relevantReviewsForCommit(
60
65
return false
61
66
}
62
67
63
- const isReviewAuthorAllowed = isAuthorAllowed ( review , reviewAuthorAssociations )
64
- if ( ! isReviewAuthorAllowed ) {
65
- core . debug (
66
- `Author @${ review . user ?. login } (${ review . author_association } ) of review ${ review . id } for commit ${ commit } is not allowed.`
67
- )
68
- return false
69
- }
70
-
71
- return true
68
+ return isReviewAuthorAllowed ( review , reviewAuthorAssociations )
72
69
} )
73
70
. sort ( ( a , b ) => {
74
71
const submittedA = a . submitted_at
0 commit comments