Skip to content

Commit f8c0629

Browse files
committed
validate archived repos
1 parent 28b7986 commit f8c0629

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

src/validate.rs

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static CHECKS: &[Check<fn(&Data, &mut Vec<String>)>] = checks![
4646
validate_zulip_group_ids,
4747
validate_zulip_group_extra_people,
4848
validate_repos,
49+
validate_archived_repos,
4950
validate_branch_protections,
5051
validate_member_roles,
5152
];
@@ -819,6 +820,15 @@ fn validate_repos(data: &Data, errors: &mut Vec<String>) {
819820
});
820821
}
821822

823+
fn validate_archived_repos(data: &Data, errors: &mut Vec<String>) {
824+
wrapper(data.archived_repos(), errors, |repo, _| {
825+
if !repo.access.teams.is_empty() {
826+
bail!("archived repo '{}' should not have any teams", repo.name);
827+
}
828+
Ok(())
829+
});
830+
}
831+
822832
/// Validate that branch protections make sense in combination with used bots.
823833
fn validate_branch_protections(data: &Data, errors: &mut Vec<String>) {
824834
let github_teams = data.github_teams();

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

+1-6
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": "admin"
13-
}
14-
],
9+
"teams": [],
1510
"members": [],
1611
"branch_protections": [
1712
{

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

+1-6
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": "admin"
11-
}
12-
],
7+
"teams": [],
138
"members": [],
149
"branch_protections": [
1510
{

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

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ description = "An archived repo!"
44
bots = []
55

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

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

0 commit comments

Comments
 (0)