Skip to content

Commit 2d8acbe

Browse files
authored
Merge pull request #1952 from Kobzol/workqueue-pr-status
Only consider PRs with certain labels to be in the reviewer workqueue
2 parents 87847d9 + 3d96801 commit 2d8acbe

File tree

8 files changed

+264
-131
lines changed

8 files changed

+264
-131
lines changed

src/github.rs

+1-55
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ use anyhow::{anyhow, Context};
22
use async_trait::async_trait;
33
use bytes::Bytes;
44
use chrono::{DateTime, FixedOffset, Utc};
5-
use futures::{future::BoxFuture, FutureExt, TryStreamExt};
5+
use futures::{future::BoxFuture, FutureExt};
66
use hyper::header::HeaderValue;
7-
use octocrab::params::pulls::Sort;
8-
use octocrab::params::{Direction, State};
9-
use octocrab::Octocrab;
107
use regex::Regex;
118
use reqwest::header::{AUTHORIZATION, USER_AGENT};
129
use reqwest::{Client, Request, RequestBuilder, Response, StatusCode};
@@ -3057,57 +3054,6 @@ async fn project_items_by_status(
30573054
Ok(all_items)
30583055
}
30593056

3060-
/// Retrieve tuples of (user, PR number) where
3061-
/// the given user is assigned as a reviewer for that PR.
3062-
/// Only non-draft, non-rollup and open PRs are taken into account.
3063-
pub async fn retrieve_pull_request_assignments(
3064-
owner: &str,
3065-
repository: &str,
3066-
client: &Octocrab,
3067-
) -> anyhow::Result<Vec<(User, PullRequestNumber)>> {
3068-
let mut assignments = vec![];
3069-
3070-
// We use the REST API to fetch open pull requests, as it is much (~5-10x)
3071-
// faster than using GraphQL here.
3072-
let stream = client
3073-
.pulls(owner, repository)
3074-
.list()
3075-
.state(State::Open)
3076-
.direction(Direction::Ascending)
3077-
.sort(Sort::Created)
3078-
.per_page(100)
3079-
.send()
3080-
.await?
3081-
.into_stream(client);
3082-
let mut stream = std::pin::pin!(stream);
3083-
while let Some(pr) = stream.try_next().await? {
3084-
if pr.draft == Some(true) {
3085-
continue;
3086-
}
3087-
// exclude rollup PRs
3088-
if pr
3089-
.labels
3090-
.unwrap_or_default()
3091-
.iter()
3092-
.any(|label| label.name == "rollup")
3093-
{
3094-
continue;
3095-
}
3096-
for user in pr.assignees.unwrap_or_default() {
3097-
assignments.push((
3098-
User {
3099-
login: user.login,
3100-
id: (*user.id).into(),
3101-
},
3102-
pr.number,
3103-
));
3104-
}
3105-
}
3106-
assignments.sort_by(|a, b| a.0.id.cmp(&b.0.id));
3107-
3108-
Ok(assignments)
3109-
}
3110-
31113057
pub enum DesignMeetingStatus {
31123058
Proposed,
31133059
Scheduled,

0 commit comments

Comments
 (0)