check labels for WIP too

This commit is contained in:
Graham Christensen 2018-02-03 12:33:26 -05:00
parent a0f3e4e3b6
commit cf52e6dfec
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -118,7 +118,7 @@ impl<E: stats::SysEvents> worker::SimpleWorker for MassRebuildWorker<E> {
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;
}