Skip to content

Commit d4cd168

Browse files
committed
Exclude drafts from auto-backport nominate
1 parent 30acfc2 commit d4cd168

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/handlers/backport.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,20 @@ pub(super) async fn parse_input(
4949
return Ok(None);
5050
};
5151

52-
// Only handle events when the PR is opened or the first comment is edited
53-
let should_check = matches!(event.action, IssuesAction::Opened | IssuesAction::Edited);
54-
if !should_check || !event.issue.is_pr() {
52+
// Only handle the event when the PR:
53+
// - is opened (and not a draft)
54+
// - is converted from draft to ready for review
55+
// - when the first comment is edited
56+
let skip_check = !matches!(
57+
event.action,
58+
IssuesAction::Opened | IssuesAction::Edited | IssuesAction::ReadyForReview
59+
);
60+
if skip_check || !event.issue.is_pr() || event.issue.draft {
5561
log::debug!(
56-
"Skipping backport event because: IssuesAction = {:?} issue.is_pr() {}",
62+
"Skipping backport event because: IssuesAction = {:?}, issue.is_pr() {}, draft = {}",
5763
event.action,
58-
event.issue.is_pr()
64+
event.issue.is_pr(),
65+
event.issue.draft
5966
);
6067
return Ok(None);
6168
}

0 commit comments

Comments
 (0)