Ignore external issue dependencies
All checks were successful
/ build (push) Successful in 1m6s

Issues in forgejo can also depend on issues from other repositories.
Ignore such external dependencies when building the techtree.
This commit is contained in:
Rahix 2025-10-17 12:46:14 +02:00
parent 1451b42912
commit c8b848d89b

View file

@ -68,6 +68,21 @@ pub async fn collect_tree(ctx: &crate::Context) -> anyhow::Result<crate::tree::T
.with_context(|| format!("Failed to fetch issue dependencies for #{issue}",))?;
for dep in dependencies {
// Check that the dependency is actually an issue in the techtree and not external
let dep_repo = dep
.repository
.context("Dependency issue without repository info")?;
if dep_repo.owner.as_ref() != Some(&ctx.owner)
|| dep_repo.name.as_ref() != Some(&ctx.repo)
{
log::warn!(
"Issue #{issue} depends on external {}#{}, ignoring.",
dep_repo.full_name.as_deref().unwrap_or("unknown?"),
dep.number.unwrap_or(9999)
);
continue;
}
let dep_number = dep.number.context("Missing issue number in dependency")?;
if !tree.find_element_by_issue_number(dep_number).is_some() {
log::warn!("Found dependency from #{issue} on non-tracked issue #{dep_number}!");