pub async fn codeowners(conf: &Config) -> Result<Vec<String>> {
    let mut output = vec![];
    let org = &conf.github.organisation;
    for mf in shipcat_filebacked::all(conf).await? {
        let md = mf.metadata;
        let mut ghids = vec![];

        if let Some(s) = conf.owners.squads.get(&md.team) {
            if let Some(gha) = &s.github.admins {
                ghids.push(format!("@{}/{}", org.to_lowercase(), gha));
            }
            // Add all squad members. Helpful because github codeowners are bad for teams
            // (Teams need to be added explicitly to the repo...)
            // Can perhaps be removed in the future
            for o in &s.members {
                if let Some(p) = conf.owners.people.get(o) {
                    if let Some(gh) = &p.github {
                        ghids.push(format!("@{}", gh));
                    }
                }
            }
        } else {
            warn!(
                "No squad found for {} in teams.yml - ignoring {}",
                md.team, mf.name
            );
        }

        if !ghids.is_empty() {
            output.push(format!("/services/{}/ {}", mf.name, ghids.join(" ")));
        }
    }
    println!("{}", output.join("\n"));
    Ok(output)
}
/// Generate codeowner strings for each service based based on team owners + admins
///
/// Cross references config.teams with manifest.metadata.team
/// Each returned string is Github CODEOWNER syntax
Generate codeowner strings for each service based based on team owners + admins
Cross references config.teams with manifest.metadata.team
Each returned string is Github CODEOWNER syntax
Generate codeowner strings for each service based based on team owners + admins Cross references config . teams with manifest . metadata . team Each returned string is Github CODEOWNER syntax
pub async fn codeowners(conf: &Config) -> Result<Vec<String>> {
    let mut output = vec![];
    let org = &conf.github.organisation;
    for mf in shipcat_filebacked::all(conf).await? {
        let md = mf.metadata;
        let mut ghids = vec![];
        if let Some(s) = conf.owners.squads.get(&md.team) {
            if let Some(gha) = &s.github.admins {
                ghids.push(format!("@{}/{}", org.to_lowercase(), gha));
            }
            // Add all squad members. Helpful because github codeowners are bad for teams
            // (Teams need to be added explicitly to the repo...)
            // Can perhaps be removed in the future
            for o in &s.members {
                if let Some(p) = conf.owners.people.get(o) {
                    if let Some(gh) = &p.github {
                        ghids.push(format!("@{}", gh));
                    }
                }
            }
        } else {
            warn!(
                "No squad found for {} in teams.yml - ignoring {}",
                md.team, mf.name
            );
        }
        if !ghids.is_empty() {
            output.push(format!("/services/{}/ {}", mf.name, ghids.join(" ")));
        }
    }
    println!("{}", output.join("\n"));
    Ok(output)
}
pub async fn codeowners ( conf : & Config ) -> Result < Vec < String > > { let mut output = vec ! [ ] ; let org = & conf . github . organisation ; for mf in shipcat_filebacked :: all ( conf ) . await ? { let md = mf . metadata ; let mut ghids = vec ! [ ] ; if let Some ( s ) = conf . owners . squads . get ( & md . team ) { if let Some ( gha ) = & s . github . admins { ghids . push ( format ! ( " " org to_lowercase ( ) gha ) ) ; } // Add all squad members. Helpful because github codeowners are bad for teams // (Teams need to be added explicitly to the repo...) // Can perhaps be removed in the future for o in & s . members { if let Some ( p ) = conf . owners . people . get ( o ) { if let Some ( gh ) = & p . github { ghids . push ( format ! ( " " gh ) ) ; } } } } else { warn ! ( " " md team mf name ) ; } if ! ghids . is_empty ( ) { output . push ( format ! ( " " mf name ghids join ( " " ) ) ) ; } } println ! ( " " output join ( " \n " ) ) ; Ok ( output ) }
Generate codeowner strings for each service based based on team owners + admins
Cross references config.teams with manifest.metadata.team
Each returned string is Github CODEOWNER syntax
Generate codeowner strings for each service based based on team owners + admins Cross references config . teams with manifest . metadata . team Each returned string is Github CODEOWNER syntax
conf
&Config
conf
&Config