-
Notifications
You must be signed in to change notification settings - Fork 87
Do not apply labels in autolabel when opening a draft PR #1968
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Actually, this won't work on its own, because when a draft PR is opened, it won't get Maybe we should modify autolabel to treat both "opened as non draft" and "converted from draft" as triggering |
I'm thinking if it makes sense applying any kind of post-processing to draft PRs. Is there anything the triagebot needs to do on drafts? Would it be too radical to set a global |
We might go in that direction, yeah. In theory we could just ignore draft PRs completely, and the first time they are converted from draft to open, we could treat it in triagebot as them opening at that very moment. But that would probably require some larger changes. |
Make sense to me. |
Ok, I changed the logic, let me know what do you think. |
8394cc9
to
ed0084f
Compare
Seems to work fine: rust-lang/rust#140889. |
// Treat the following situations as a "new PR": | ||
// 1) New PRs opened as non-draft | ||
// 2) PRs opened as draft that are marked as "ready for review" for the first time. | ||
let is_new_non_draft_pr = event.action == IssuesAction::Opened && !event.issue.draft; | ||
let is_first_time_ready_for_review = | ||
event.action == IssuesAction::ReadyForReview && !state.data.new_pr_labels_applied; | ||
if cfg.new_pr && (is_new_non_draft_pr || is_first_time_ready_for_review) { | ||
autolabels.push(Label { | ||
name: label.to_owned(), | ||
}); | ||
state.data.new_pr_labels_applied = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have stayed in the condition above, as we are putting new_pr labels on issues instead of only PRs.
I knew this was iffy, but couldn't prove it, thks @jieyouxu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #1983 to fix it.
After #1963, it doesn't make sense to apply
S-waiting-on-review
to PRs opened as a draft. According to https://github.com/search?type=code&q=org%3Arust-lang+%22new_pr+%3D+true%22, this option is only ever used for addingS-waiting-on-review
in the rust-lang org, so I don't think that we need to complicate the settings by adding some "new_nondraft_pr" setting or something like that.