Skip to content

Commit fb1c3f6

Browse files
authored
Merge pull request #1754 from rust-lang/archived-repo-validation
validate archived repositories have no teams
2 parents e7fc7c7 + cc3e55e commit fb1c3f6

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

src/validate.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static CHECKS: &[Check<fn(&Data, &mut Vec<String>)>] = checks![
5151
validate_zulip_stream_ids,
5252
validate_zulip_stream_extra_people,
5353
validate_repos,
54+
validate_archived_repos,
5455
validate_branch_protections,
5556
validate_member_roles,
5657
validate_admin_access,
@@ -891,6 +892,15 @@ fn validate_repos(data: &Data, errors: &mut Vec<String>) {
891892
});
892893
}
893894

895+
fn validate_archived_repos(data: &Data, errors: &mut Vec<String>) {
896+
wrapper(data.archived_repos(), errors, |repo, _| {
897+
if !repo.access.teams.is_empty() {
898+
bail!("archived repo '{}' should not have any teams", repo.name);
899+
}
900+
Ok(())
901+
});
902+
}
903+
894904
/// Validate that branch protections make sense in combination with used bots.
895905
fn validate_branch_protections(data: &Data, errors: &mut Vec<String>) {
896906
let github_teams = data.github_teams();

tests/static-api/_expected/v1/repos.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
"description": "An archived repo!",
77
"homepage": null,
88
"bots": [],
9-
"teams": [
10-
{
11-
"name": "foo",
12-
"permission": "maintain"
13-
}
14-
],
9+
"teams": [],
1510
"members": [],
1611
"branch_protections": [
1712
{

tests/static-api/_expected/v1/repos/archived_repo.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
"description": "An archived repo!",
55
"homepage": null,
66
"bots": [],
7-
"teams": [
8-
{
9-
"name": "foo",
10-
"permission": "maintain"
11-
}
12-
],
7+
"teams": [],
138
"members": [],
149
"branch_protections": [
1510
{

tests/static-api/repos/archive/test-org/archived_repo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ description = "An archived repo!"
44
bots = []
55

66
[access.teams]
7-
foo = "maintain"
87

98
[[branch-protections]]
109
pattern = "master"

0 commit comments

Comments
 (0)