manager: Mark completion using a label
All checks were successful
/ build (push) Successful in 1m7s

Don't use the open/close state of the issues to mark their completion.
This has friction with dependencies, because you can only add
dependencies on open issues.

Instead, issues are marked as completed using a "Completed" label now.
This commit is contained in:
Rahix 2025-05-23 00:44:36 +02:00
parent 8ae5ff6b81
commit b484256246
2 changed files with 14 additions and 11 deletions

View file

@ -77,10 +77,12 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
.context("Issue is missing a title")?
.to_owned();
let ty_labels: Vec<_> = issue
let labels = issue
.labels
.as_ref()
.context("Issue does not have any labels")?
.context("Issue does not have any labels")?;
let ty_labels: Vec<_> = labels
.iter()
.filter_map(|l| l.name.as_deref())
.filter(|l| l.starts_with("Type/"))
@ -100,9 +102,15 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
.unwrap()
.to_owned();
let has_completed_label = labels
.iter()
.any(|l| l.name.as_deref() == Some("Completed"));
let status = match issue.state.context("Missing issue state")? {
forgejo_api::structs::StateType::Open => {
if issue.assignee.is_some()
if has_completed_label {
crate::tree::ElementStatus::Completed
} else if issue.assignee.is_some()
|| issue
.assignees
.as_ref()
@ -114,7 +122,7 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
crate::tree::ElementStatus::Missing
}
}
forgejo_api::structs::StateType::Closed => crate::tree::ElementStatus::Completed,
forgejo_api::structs::StateType::Closed => anyhow::bail!("Ignoring closed issue!"),
};
Ok(crate::tree::Element {