Skip to content

Commit

Permalink
fix: resolve conflict remanants
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed Dec 11, 2024
1 parent b6890cf commit 6907045
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions crates/gh-workflow/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,8 @@ fn organize_job_dependency(mut workflow: Workflow) -> Workflow {
workflow
}

fn find_job<'a>(
dep_job: &Job,
new_jobs: &'a IndexMap<String, Job>,
workflow: &'a Workflow,
) -> Option<&'a str> {
let in_new_jobs: Option<&'a str> =
new_jobs
.iter()
.find_map(|(k, v)| if v == dep_job { Some(k.as_str()) } else { None });

let in_old_jobs: Option<&'a str> = workflow.jobs.as_ref().and_then(|jobs| {
jobs.0.iter().find_map(|(id, j)| {
if j == dep_job {
Some(id.as_str())
} else {
None
}
})
});

in_new_jobs.or(in_old_jobs)
/// Find a job in the new_jobs or old_jobs
fn find_value<'a, K, V: PartialEq>(job: &V, map: &'a IndexMap<K, V>) -> Option<&'a K> {
map.iter()
.find_map(|(k, v)| if v == job { Some(k) } else { None })
}

0 comments on commit 6907045

Please sign in to comment.