Skip to content

Commit 92e6119

Browse files
committed
Add exclude labels pattern handling
This is to support not prioritizing issues tagged with `T-rustdoc`, `T-infra` and `T-release`.
1 parent f9ff127 commit 92e6119

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub(crate) struct PrioritizeConfig {
8181
#[serde(default)]
8282
pub(crate) prioritize_on: Vec<String>,
8383
#[serde(default)]
84-
pub(crate) priority_labels: String,
84+
pub(crate) exclude_labels: Vec<String>,
8585
pub(crate) zulip_stream: u64,
8686
}
8787

src/handlers/prioritize.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,23 @@ impl Handler for PrioritizeHandler {
3939
// We need to take the exact same action in this case.
4040
return Ok(Some(Prioritize::Start));
4141
} else {
42-
match glob::Pattern::new(&config.priority_labels) {
43-
Ok(glob) => {
44-
let issue_labels = event.issue().unwrap().labels();
45-
let label_name = &e.label.as_ref().expect("label").name;
42+
let label_name = &e.label.as_ref().expect("label").name;
4643

47-
if issue_labels.iter().all(|l| !glob.matches(&l.name))
48-
&& config.prioritize_on.iter().any(|l| l == label_name)
49-
{
50-
return Ok(Some(Prioritize::Label));
44+
if config.prioritize_on.iter().any(|l| l == label_name)
45+
&& config.exclude_labels.iter().all(|exclude_label| {
46+
match glob::Pattern::new(exclude_label) {
47+
Ok(glob) => {
48+
let issue_labels = event.issue().unwrap().labels();
49+
issue_labels.iter().all(|l| !glob.matches(&l.name))
50+
}
51+
Err(error) => {
52+
log::error!("Invalid glob pattern: {}", error);
53+
false
54+
}
5155
}
52-
}
53-
Err(error) => log::error!("Invalid glob pattern: {}", error),
56+
})
57+
{
58+
return Ok(Some(Prioritize::Label));
5459
}
5560
}
5661
}

0 commit comments

Comments
 (0)