Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ghost GH user to skip PR workqueue check #1794

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/handlers/assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,16 +766,22 @@ async fn find_reviewer_from_names(
// These are all ideas for improving the selection here. However, I'm not
// sure they are really worth the effort.

// filter out team members without capacity
let filtered_candidates = filter_by_capacity(db, &candidates)
.await
.expect("Error while filtering out team members");

if filtered_candidates.is_empty() {
return Err(FindReviewerError::AllReviewersFiltered {
initial: names.to_vec(),
filtered: names.to_vec(),
});
// If we are trying to assign to the ghost GitHub user, bypass every check
let mut filtered_candidates: HashSet<String> = HashSet::new();
if candidates.contains("ghost") {
filtered_candidates.insert("ghost".to_string());
} else {
// filter out team members without capacity
filtered_candidates = filter_by_capacity(db, &candidates)
apiraino marked this conversation as resolved.
Show resolved Hide resolved
.await
.expect("Error while filtering out team members");

if filtered_candidates.is_empty() {
return Err(FindReviewerError::AllReviewersFiltered {
initial: names.to_vec(),
filtered: names.to_vec(),
});
}
}

log::debug!("Filtered list of candidates: {:?}", filtered_candidates);
Expand All @@ -787,6 +793,7 @@ async fn find_reviewer_from_names(
.to_string())
}

// FIXME: this query probably needs to take into account when max_assigned_prs is null
/// Filter out candidates not having review capacity
async fn filter_by_capacity(
db: &DbClient,
Expand Down
Loading