Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions auto_submit/lib/service/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ class Config {
);

/// Pull request approval message
static const String pullRequestApprovalRequirementsMessage =
static String pullRequestApprovalRequirementsMessage(String approvalGroup) =>
'- Merge guidelines: A PR needs at least one approved review if the author is already '
'part of flutter-hackers or two member reviews if the author is not a flutter-hacker '
'part of $approvalGroup or two member reviews if the author is not a member of $approvalGroup '
'before re-applying the autosubmit label. __Reviewers__: If you left a comment '
'approving, please use the "approve" review action instead.';

Expand Down
2 changes: 1 addition & 1 deletion auto_submit/lib/validations/approval.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Approval extends Validation {

message = approved
? approvedMessage
: '$approvedMessage\n${Config.pullRequestApprovalRequirementsMessage}';
: '$approvedMessage\n${Config.pullRequestApprovalRequirementsMessage(repositoryConfiguration.approvalGroup)}';
}

return ValidationResult(approved, action, message);
Expand Down
36 changes: 36 additions & 0 deletions auto_submit/test/validations/approval_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,41 @@ void main() {
isTrue,
);
});
test(
'pullRequestApprovalRequirementsMessage takes approval_group from config',
() async {
config.repositoryConfigurationMock = RepositoryConfiguration.fromYaml(
'''
default_branch: main
allow_config_override: false
auto_approval_accounts:
- dependabot[bot]
- dependabot
- DartDevtoolWorkflowBot
approving_reviews: 2
approval_group: custom-group
run_ci: true
support_no_review_revert: true
required_checkruns_on_revert:
- ci.yaml validation
''',
);
approval = Approval(config: config);

githubService.isTeamMemberMockMap['author1'] = false;
githubService.isTeamMemberMockMap['keyonghan'] = false;
final review = constructSingleReviewerReview(reviewState: 'APPROVED');

final result = await computeValidationResult(review);

expect(result.result, isFalse);
expect(
result.message.contains(
'part of custom-group or two member reviews if the author is not a member of custom-group',
),
isTrue,
);
},
);
});
}
Loading