Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bef1a99

Browse files
committedMay 14, 2020
Use prioritize_on field to start prioritization process
1 parent 5285ce7 commit bef1a99

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
 

‎src/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ pub(crate) struct RelabelConfig {
7878
#[derive(PartialEq, Eq, Debug, serde::Deserialize)]
7979
pub(crate) struct PrioritizeConfig {
8080
pub(crate) label: String,
81+
#[serde(default)]
82+
pub(crate) prioritize_on: Vec<String>,
83+
#[serde(default)]
84+
pub(crate) priority_labels: String,
8185
pub(crate) zulip_stream: u64,
8286
}
8387

‎src/handlers/prioritize.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ impl Handler for PrioritizeHandler {
3838
if e.label.as_ref().expect("label").name == config.label {
3939
// We need to take the exact same action in this case.
4040
return Ok(Some(Prioritize::Start));
41+
} else {
42+
if let Ok(glob) = glob::Pattern::new(&config.priority_labels) {
43+
let issue_labels = event.issue().unwrap().labels();
44+
let label_name = &e.label.as_ref().expect("label").name;
45+
46+
if issue_labels.iter().all(|l| !glob.matches(&l.name))
47+
&& config.prioritize_on.iter().any(|l| l == label_name)
48+
{
49+
return Ok(Some(Prioritize::Label));
50+
}
51+
}
4152
}
4253
}
4354
}

0 commit comments

Comments
 (0)
Please sign in to comment.