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
10 changes: 10 additions & 0 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static CHECKS: &[Check<fn(&Data, &mut Vec<String>)>] = checks![
validate_zulip_stream_ids,
validate_zulip_stream_extra_people,
validate_repos,
validate_archived_repos,
validate_branch_protections,
validate_member_roles,
validate_admin_access,
Expand Down Expand Up @@ -891,6 +892,15 @@ fn validate_repos(data: &Data, errors: &mut Vec<String>) {
});
}

fn validate_archived_repos(data: &Data, errors: &mut Vec<String>) {
wrapper(data.archived_repos(), errors, |repo, _| {
if !repo.access.teams.is_empty() {
bail!("archived repo '{}' should not have any teams", repo.name);
}
Ok(())
});
}

/// Validate that branch protections make sense in combination with used bots.
fn validate_branch_protections(data: &Data, errors: &mut Vec<String>) {
let github_teams = data.github_teams();
Expand Down
7 changes: 1 addition & 6 deletions tests/static-api/_expected/v1/repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
"description": "An archived repo!",
"homepage": null,
"bots": [],
"teams": [
{
"name": "foo",
"permission": "maintain"
}
],
"teams": [],
"members": [],
"branch_protections": [
{
Expand Down
7 changes: 1 addition & 6 deletions tests/static-api/_expected/v1/repos/archived_repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
"description": "An archived repo!",
"homepage": null,
"bots": [],
"teams": [
{
"name": "foo",
"permission": "maintain"
}
],
"teams": [],
"members": [],
"branch_protections": [
{
Expand Down
1 change: 0 additions & 1 deletion tests/static-api/repos/archive/test-org/archived_repo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ description = "An archived repo!"
bots = []

[access.teams]
foo = "maintain"

[[branch-protections]]
pattern = "master"
Expand Down