diff --git a/src/config.rs b/src/config.rs index 3ec99725..cbd682e9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -213,6 +213,10 @@ pub(crate) struct AutolabelLabelConfig { #[serde(default)] pub(crate) new_draft_pr: bool, #[serde(default)] + pub(crate) reopened_pr: bool, + #[serde(default)] + pub(crate) reopened_draft_pr: bool, + #[serde(default)] pub(crate) new_issue: bool, } diff --git a/src/handlers/autolabel.rs b/src/handlers/autolabel.rs index dae3fb16..26a00428 100644 --- a/src/handlers/autolabel.rs +++ b/src/handlers/autolabel.rs @@ -26,7 +26,10 @@ pub(super) async fn parse_input( // FIXME: This will re-apply labels after a push that the user had tried to // remove. Not much can be done about that currently; the before/after on // synchronize may be straddling a rebase, which will break diff generation. - if event.action == IssuesAction::Opened || event.action == IssuesAction::Synchronize { + if matches!( + &event.action, + IssuesAction::Opened | IssuesAction::Reopened | IssuesAction::Synchronize + ) { let files = event .issue .diff(&ctx.github) @@ -80,6 +83,16 @@ pub(super) async fn parse_input( }); } + if event.issue.is_pr() + && matches!(event.action, IssuesAction::Reopened) + && ((cfg.reopened_pr && !event.issue.draft) + || (cfg.reopened_draft_pr && event.issue.draft)) + { + autolabels.push(Label { + name: label.to_owned(), + }); + } + if !event.issue.is_pr() && cfg.new_issue && event.action == IssuesAction::Opened { autolabels.push(Label { name: label.to_owned(),