Skip to content

Commit 2b2130a

Browse files
committed
create codeowners parent dir
1 parent 77a0b73 commit 2b2130a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/ownership/parser.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ impl Parser {
5454

5555
#[memoize]
5656
fn teams_by_github_team_name(team_file_glob: Vec<String>) -> HashMap<String, Team> {
57-
dbg!("in teams_by_github_team_name");
5857
let mut teams = HashMap::new();
5958
for glob in team_file_glob {
6059
let paths = glob::glob(&glob).expect("Failed to read glob pattern").filter_map(Result::ok);
@@ -76,8 +75,6 @@ fn teams_by_github_team_name(team_file_glob: Vec<String>) -> HashMap<String, Tea
7675

7776
#[memoize]
7877
fn build_codeowners_lines_in_priority(codeowners_file_path: String) -> Vec<String> {
79-
dbg!("in build_codeowners_lines_in_priority");
80-
dbg!(&codeowners_file_path);
8178
let codeowners_file = match fs::read_to_string(codeowners_file_path) {
8279
Ok(codeowners_file) => codeowners_file,
8380
Err(e) => {

src/runner.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ impl Runner {
198198
}
199199

200200
pub fn generate(&self) -> RunResult {
201-
match std::fs::write(&self.run_config.codeowners_file_path, self.ownership.generate_file()) {
201+
let content = self.ownership.generate_file();
202+
if let Some(parent) = &self.run_config.codeowners_file_path.parent() {
203+
let _ = std::fs::create_dir_all(parent);
204+
}
205+
match std::fs::write(&self.run_config.codeowners_file_path, content) {
202206
Ok(_) => RunResult::default(),
203207
Err(err) => RunResult {
204208
io_errors: vec![err.to_string()],

0 commit comments

Comments
 (0)