Skip to content

Commit afcdb93

Browse files
committed
Add support for rust-timer bot
It merges unrolled rollup builds into the `try-perf` and `perf-tmp` branches on `rust-lang-ci/rust`.
1 parent 7d3eac2 commit afcdb93

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

rust_team_data/src/v1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ pub enum BranchProtectionMode {
246246
#[serde(rename_all = "snake_case")]
247247
pub enum MergeBot {
248248
Homu,
249+
RustTimer,
249250
}
250251

251252
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]

src/schema.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ pub(crate) enum RepoPermission {
870870
#[serde(rename_all = "kebab-case")]
871871
pub(crate) enum MergeBot {
872872
Homu,
873+
RustTimer,
873874
}
874875

875876
#[derive(serde_derive::Deserialize, Debug)]

src/static_api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ impl<'a> Generator<'a> {
6666
.iter()
6767
.map(|bot| match bot {
6868
MergeBot::Homu => v1::MergeBot::Homu,
69+
MergeBot::RustTimer => v1::MergeBot::RustTimer,
6970
})
7071
.collect(),
7172
})

sync-team/src/github/mod.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,10 @@ pub fn construct_branch_protection(
512512
expected_repo: &rust_team_data::v1::Repo,
513513
branch_protection: &rust_team_data::v1::BranchProtection,
514514
) -> api::BranchProtection {
515-
let uses_homu = branch_protection.merge_bots.contains(&MergeBot::Homu);
516-
// When homu manages a branch, we should not require a PR nor approvals
517-
// for that branch, because homu pushes to these branches directly.
518-
let branch_protection_mode = if uses_homu {
515+
let uses_merge_bot = !branch_protection.merge_bots.is_empty();
516+
// When a merge bot manages a branch, we should not require a PR nor approvals
517+
// for that branch, because it will (force) push to these branches directly.
518+
let branch_protection_mode = if uses_merge_bot {
519519
BranchProtectionMode::PrNotRequired
520520
} else {
521521
branch_protection.mode.clone()
@@ -542,10 +542,16 @@ pub fn construct_branch_protection(
542542
})
543543
.collect();
544544

545-
if uses_homu {
546-
push_allowances.push(PushAllowanceActor::User(api::UserPushAllowanceActor {
547-
login: "bors".to_owned(),
548-
}));
545+
for merge_bot in &branch_protection.merge_bots {
546+
let allowance = match merge_bot {
547+
MergeBot::Homu => PushAllowanceActor::User(api::UserPushAllowanceActor {
548+
login: "bors".to_owned(),
549+
}),
550+
MergeBot::RustTimer => PushAllowanceActor::User(api::UserPushAllowanceActor {
551+
login: "rust-timer".to_owned(),
552+
}),
553+
};
554+
push_allowances.push(allowance);
549555
}
550556

551557
let mut checks = match &branch_protection_mode {

0 commit comments

Comments
 (0)