don't request maintainer reviews if many files changed

This either indicates it's most likely either a tree-wide change,
staging-next merge or just a pull request with an incorrect target
branch.  For none of these cases are usually relevant for specific
package maintainers.
This commit is contained in:
Daiderd Jordan 2020-05-15 22:13:46 +02:00 committed by Cole Helbling
parent ec4decddcc
commit ec5e59a055

View file

@ -24,9 +24,11 @@ use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output};
use hubcaps::gists::Gists;
use hubcaps::issues::{Issue, IssueRef};
use hubcaps::repositories::Repository;
use tracing::warn;
use tracing::{info, warn};
use uuid::Uuid;
static MAINTAINER_REVIEW_MAX_CHANGED_PATHS: usize = 64;
pub struct NixpkgsStrategy<'a> {
job: &'a EvaluationJob,
pull: &'a hubcaps::pulls::PullRequest<'a>,
@ -270,6 +272,22 @@ impl<'a> NixpkgsStrategy<'a> {
},
);
if changed_paths.len() > MAINTAINER_REVIEW_MAX_CHANGED_PATHS {
info!(
"pull request has {} changed paths, skipping review requests",
changed_paths.len()
);
let status = CommitStatus::new(
self.repo.statuses(),
self.job.pr.head_sha.clone(),
String::from("grahamcofborg-eval-check-maintainers"),
String::from("large change, skipping automatic review requests"),
gist_url,
);
status.set(hubcaps::statuses::State::Success)?;
return Ok(());
}
let status = CommitStatus::new(
self.repo.statuses(),
self.job.pr.head_sha.clone(),