Skip to content

Commit 29cb0a0

Browse files
committed
Implement r? ghost to mean unassign the current reviewer
1 parent ded85ba commit 29cb0a0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/handlers/assign.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,15 @@ pub(super) async fn handle_command(
476476
}
477477
};
478478

479+
// In the PR body, `r? ghost` means "do not assign anybody".
480+
// When you send `r? ghost` in a PR comment, it should mean "unassign the current assignee".
481+
// Only allow this for the PR author (usually when they forget to do `r? ghost` in the PR
482+
// body), otherwise anyone could remove assignees from any PR.
483+
if assignee == GHOST_ACCOUNT && issue.user.login == event.user().login {
484+
issue.remove_assignees(&ctx.github, Selection::All).await?;
485+
return Ok(());
486+
}
487+
479488
let db_client = ctx.db.get().await;
480489
let assignee = match find_reviewer_from_names(
481490
&db_client,

0 commit comments

Comments
 (0)