From cf52e6dfec0172cd026502d9193241ae183d101f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 3 Feb 2018 12:33:26 -0500 Subject: [PATCH] check labels for WIP too --- ofborg/src/tasks/massrebuilder.rs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/ofborg/src/tasks/massrebuilder.rs b/ofborg/src/tasks/massrebuilder.rs index 9d23bdb..d06d470 100644 --- a/ofborg/src/tasks/massrebuilder.rs +++ b/ofborg/src/tasks/massrebuilder.rs @@ -118,7 +118,7 @@ impl worker::SimpleWorker for MassRebuildWorker { return self.actions().skip(&job); } - if iss.title.to_lowercase().contains("wip") { + if issue_is_wip(&iss) { auto_schedule_build_archs = vec![]; } else { auto_schedule_build_archs = self.acl.build_job_destinations_for_user_repo( @@ -769,3 +769,29 @@ mod tests { ); } } + +fn issue_is_wip(issue: &hubcaps::issues::Issue) -> bool { + if indicates_wip(&issue.title) { + return true; + } + + issue.labels.iter().any(|label| indicates_wip(&label.name)) +} + +fn indicates_wip(text: &str) -> bool { + let text = text.to_lowercase(); + + if text.contains("wip") { + return true; + } + + if text.contains("work in progress") { + return true; + } + + if text.contains("work-in-progress") { + return true; + } + + return false; +}