File tree 2 files changed +19
-7
lines changed
2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,13 @@ impl Data {
210
210
}
211
211
result
212
212
}
213
+
214
+ pub ( crate ) fn is_team_archived ( & self , team_name : & str , org : & str ) -> bool {
215
+ self . archived_teams ( )
216
+ . filter_map ( |team| team. github_teams ( self ) . ok ( ) )
217
+ . flatten ( )
218
+ . any ( |github_team| github_team. name == team_name && github_team. org == org)
219
+ }
213
220
}
214
221
215
222
fn load_file < T : DeserializeOwned > ( path : & Path ) -> Result < T , Error > {
Original file line number Diff line number Diff line change @@ -868,20 +868,25 @@ fn validate_repos(data: &Data, errors: &mut Vec<String>) {
868
868
}
869
869
for team_name in repo. access . teams . keys ( ) {
870
870
if !github_teams. contains ( & ( repo. org . clone ( ) , team_name. clone ( ) ) ) {
871
+ let error_reason = if data. is_team_archived ( team_name, & repo. org ) {
872
+ "is archived. Please remove the team access from the `[access.teams]` section of the repo"
873
+ } else {
874
+ "is not present in the `/teams/` folder"
875
+ } ;
876
+
871
877
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
- )
878
+ "Access for the repo {}/{} is invalid: the team '{}/{team_name}' {error_reason}." ,
879
+ repo. org,
880
+ repo. name,
881
+ repo. org,
882
+ ) ;
878
883
}
879
884
}
880
885
881
886
for name in repo. access . individuals . keys ( ) {
882
887
if data. person ( name) . is_none ( ) {
883
888
bail ! (
884
- "access for {}/{} is invalid: '{}' is not the name of a person in the team repo" ,
889
+ "Access for the repo {}/{} is invalid: '{}' is not the name of a person in the team repo" ,
885
890
repo. org,
886
891
repo. name,
887
892
name
You can’t perform that action at this time.
0 commit comments