-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
write code to generate the FCP comment
- Loading branch information
1 parent
42b4981
commit 425586a
Showing
5 changed files
with
97 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::{collections::BTreeSet, path::Path}; | ||
|
||
use crate::{goal, team::TeamName}; | ||
|
||
pub fn generate_comment(path: &Path) -> anyhow::Result<()> { | ||
let goal_documents = goal::goals_in_dir(path)?; | ||
let teams_with_asks: BTreeSet<&TeamName> = goal_documents | ||
.iter() | ||
.flat_map(|g| &g.team_asks) | ||
.flat_map(|ask| &ask.teams) | ||
.copied() | ||
.collect(); | ||
|
||
for team_name in teams_with_asks { | ||
let team_data = team_name.data(); | ||
|
||
println!("\n## {}\n", team_data.name); | ||
|
||
let (leads, members): (Vec<_>, Vec<_>) = team_data.members.iter().partition(|m| m.is_lead); | ||
|
||
for lead in leads { | ||
println!("* [ ] @{} (required, lead)", lead.github); | ||
} | ||
|
||
for member in members { | ||
println!("* [ ] @{} (optional)", member.github); | ||
} | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters