Skip to content

Commit b542f2a

Browse files
committed
Add new_pr autolabel.
This adds a setting to the auto-label handler so that it can automatically add a label to all new PRs.
1 parent 1957183 commit b542f2a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ pub(crate) struct AutolabelLabelConfig {
142142
pub(crate) exclude_labels: Vec<String>,
143143
#[serde(default)]
144144
pub(crate) trigger_files: Vec<String>,
145+
#[serde(default)]
146+
pub(crate) new_pr: bool,
145147
}
146148

147149
#[derive(PartialEq, Eq, Debug, serde::Deserialize)]

src/handlers/autolabel.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ pub(super) async fn parse_input(
6868
name: label.to_owned(),
6969
});
7070
}
71+
if cfg.new_pr && event.action == IssuesAction::Opened {
72+
autolabels.push(Label {
73+
name: label.to_owned(),
74+
});
75+
}
7176
}
7277
if !autolabels.is_empty() {
7378
return Ok(Some(AutolabelInput {

0 commit comments

Comments
 (0)