tasks/evaluate: error on PRs targeting nixos-* or nixpkgs-* branches

A PR's target branch is easy to overlook. ofborg should complain loudly
if a nixos-* or nixpkgs-* branch is the target of a PR.
This commit is contained in:
Cole Helbling 2021-01-15 21:49:36 -08:00
parent 5b5a13eb69
commit f56bea3b10

View file

@ -334,6 +334,17 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
None => String::from("master"), None => String::from("master"),
}; };
if target_branch.starts_with("nixos-") || target_branch.starts_with("nixpkgs-") {
overall_status.set_with_description(
"The branch you have targeted is a read-only mirror for channels. \
Please target release-* or master.",
hubcaps::statuses::State::Error,
)?;
info!("PR targets a nixos-* or nixpkgs-* branch");
return Ok(self.actions().skip(&job));
};
overall_status.set_with_description( overall_status.set_with_description(
format!("Checking out {}", &target_branch).as_ref(), format!("Checking out {}", &target_branch).as_ref(),
hubcaps::statuses::State::Pending, hubcaps::statuses::State::Pending,