Skip to content

Commit 30676bf

Browse files
committed
Handle closing and reopening PRs for the [autolabel] new_pr labels
1 parent 0c50534 commit 30676bf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/handlers/autolabel.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub(super) async fn parse_input(
2929
if matches!(
3030
event.action,
3131
IssuesAction::Opened
32+
| IssuesAction::Closed
33+
| IssuesAction::Reopened
3234
| IssuesAction::Synchronize
3335
| IssuesAction::ReadyForReview
3436
| IssuesAction::ConvertedToDraft
@@ -87,16 +89,22 @@ pub(super) async fn parse_input(
8789
// 1) New PRs opened as non-draft
8890
// 2) PRs opened as draft that are marked as "ready for review".
8991
let is_new_non_draft_pr =
90-
event.action == IssuesAction::Opened && !event.issue.draft;
92+
matches!(event.action, IssuesAction::Opened | IssuesAction::Reopened)
93+
&& !event.issue.draft;
9194
let is_ready_for_review = event.action == IssuesAction::ReadyForReview;
9295
if cfg.new_pr && (is_new_non_draft_pr || is_ready_for_review) {
9396
autolabels.push(Label {
9497
name: label.to_owned(),
9598
});
9699
}
97100

98-
// If a PR is converted to draft remove all the "new PR" labels
99-
if cfg.new_pr && event.action == IssuesAction::ConvertedToDraft {
101+
// If a PR is converted to draft or closed, remove all the "new PR" labels
102+
if cfg.new_pr
103+
&& matches!(
104+
event.action,
105+
IssuesAction::ConvertedToDraft | IssuesAction::Closed
106+
)
107+
{
100108
to_remove.push(Label {
101109
name: label.to_owned(),
102110
});

0 commit comments

Comments
 (0)