@@ -82,6 +82,8 @@ pub(super) async fn parse_input(
82
82
} ) ) ,
83
83
// We don't need to handle Opened explicitly, because that will trigger the Assigned event
84
84
IssuesAction :: Reopened
85
+ | IssuesAction :: ReadyForReview
86
+ | IssuesAction :: ConvertedToDraft
85
87
| IssuesAction :: Closed
86
88
| IssuesAction :: Deleted
87
89
| IssuesAction :: Transferred
@@ -107,7 +109,7 @@ pub(super) async fn handle_input<'a>(
107
109
// If the PR doesn't wait for a review, remove it from the workqueue completely.
108
110
// This handles situations such as labels being modified, which make the PR no longer to be
109
111
// in the "waiting for a review" state, or the PR being closed/merged.
110
- if !waits_for_a_review ( & pr. labels , pr. is_open ( ) , pr. draft ) {
112
+ if !waits_for_a_review ( & pr. labels , & pr . assignees , & pr . user , pr. is_open ( ) , pr. draft ) {
111
113
log:: info!(
112
114
"Removing PR {pr_number} from workqueue, because it is not waiting for a review." ,
113
115
) ;
@@ -200,8 +202,23 @@ pub async fn retrieve_pull_request_assignments(
200
202
. into_iter ( )
201
203
. map ( |l| Label { name : l. name } )
202
204
. collect :: < Vec < Label > > ( ) ;
205
+ let assignees = pr
206
+ . assignees
207
+ . as_ref ( )
208
+ . map ( |authors| authors. iter ( ) . map ( User :: from) . collect :: < Vec < _ > > ( ) )
209
+ . unwrap_or_default ( ) ;
210
+ let author = pr
211
+ . user
212
+ . as_ref ( )
213
+ . map ( |author| User :: from ( author. as_ref ( ) ) )
214
+ . unwrap_or_else ( || User {
215
+ login : "ghost" . to_string ( ) ,
216
+ id : 0 ,
217
+ } ) ;
203
218
if waits_for_a_review (
204
219
& labels,
220
+ & assignees,
221
+ & author,
205
222
pr. state == Some ( IssueState :: Open ) ,
206
223
pr. draft . unwrap_or_default ( ) ,
207
224
) {
@@ -269,14 +286,26 @@ fn delete_pr_from_all_queues(workqueue: &mut ReviewerWorkqueue, pr: PullRequestN
269
286
///
270
287
/// Note: this functionality is currently hardcoded for rust-lang/rust, other repos might use
271
288
/// different labels.
272
- fn waits_for_a_review ( labels : & [ Label ] , is_open : bool , is_draft : bool ) -> bool {
289
+ fn waits_for_a_review (
290
+ labels : & [ Label ] ,
291
+ assignees : & [ User ] ,
292
+ author : & User ,
293
+ is_open : bool ,
294
+ is_draft : bool ,
295
+ ) -> bool {
273
296
let is_blocked = labels
274
297
. iter ( )
275
298
. any ( |l| l. name == "S-blocked" || l. name == "S-inactive" ) ;
276
299
let is_rollup = labels. iter ( ) . any ( |l| l. name == "rollup" ) ;
277
300
let is_waiting_for_reviewer = labels. iter ( ) . any ( |l| l. name == "S-waiting-on-review" ) ;
278
-
279
- is_open && !is_draft && !is_blocked && !is_rollup && is_waiting_for_reviewer
301
+ let is_assigned_to_author = assignees. contains ( author) ;
302
+
303
+ is_open
304
+ && !is_draft
305
+ && !is_blocked
306
+ && !is_rollup
307
+ && is_waiting_for_reviewer
308
+ && !is_assigned_to_author
280
309
}
281
310
282
311
#[ cfg( test) ]
0 commit comments