Skip to content

Commit a60dd9d

Browse files
committed
improve repo validation error message
1 parent 92c25e8 commit a60dd9d

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/validate.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -868,20 +868,26 @@ fn validate_repos(data: &Data, errors: &mut Vec<String>) {
868868
}
869869
for team_name in repo.access.teams.keys() {
870870
if !github_teams.contains(&(repo.org.clone(), team_name.clone())) {
871+
let is_team_archived = data.archived_teams().any(|t| t.name() == team_name);
872+
let error_reason = if is_team_archived {
873+
"is archived. Please remove it from the repo"
874+
} else {
875+
"is not present in the `/teams/` folder"
876+
};
877+
871878
bail!(
872-
"access for {}/{} is invalid: '{}' is not configured as a GitHub team for the '{}' org",
873-
repo.org,
874-
repo.name,
875-
team_name,
876-
repo.org
877-
)
879+
"Access for the repo {}/{} is invalid: the team '{}/{team_name}' {error_reason}.",
880+
repo.org,
881+
repo.name,
882+
repo.org,
883+
);
878884
}
879885
}
880886

881887
for name in repo.access.individuals.keys() {
882888
if data.person(name).is_none() {
883889
bail!(
884-
"access for {}/{} is invalid: '{}' is not the name of a person in the team repo",
890+
"Access for the repo {}/{} is invalid: '{}' is not the name of a person in the team repo",
885891
repo.org,
886892
repo.name,
887893
name

0 commit comments

Comments
 (0)