Skip to content

Commit e1c1ba6

Browse files
committed
revert: allowed merged users
1 parent 023b6b5 commit e1c1ba6

9 files changed

Lines changed: 3 additions & 56 deletions

File tree

docs/toml-schema.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,6 @@ required-approvals = 1
421421
# in [access.teams].
422422
# (optional)
423423
allowed-merge-teams = ["awesome-team"]
424-
# Enable bypass for organization administrators.
425-
# Due to GitHub API limitations, individual users cannot be granted bypass
426-
# access directly. Instead, this grants bypass to all organization admins.
427-
# For granular control, add users to a team and use allowed-merge-teams.
428-
# (optional)
429-
allowed-merge-users = ["any-username"] # Enables OrganizationAdmin bypass
430424
# Determines the merge queue bot(s) that manage pushes to this branch.
431425
# When a bot manages the queue, some other options, like
432426
# `required-approvals` and `pr-required` options are not valid.

rust_team_data/src/v1.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,6 @@ pub struct BranchProtection {
258258
pub dismiss_stale_review: bool,
259259
pub mode: BranchProtectionMode,
260260
pub allowed_merge_teams: Vec<String>,
261-
#[serde(default)]
262-
pub allowed_merge_users: Vec<String>,
263261
pub merge_bots: Vec<MergeBot>,
264262
}
265263

src/schema.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,6 @@ pub(crate) struct BranchProtection {
877877
#[serde(default)]
878878
pub allowed_merge_teams: Vec<String>,
879879
#[serde(default)]
880-
pub allowed_merge_users: Vec<String>,
881-
#[serde(default)]
882880
pub merge_bots: Vec<MergeBot>,
883881
}
884882

src/static_api.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ impl<'a> Generator<'a> {
6262
BranchProtectionMode::PrNotRequired
6363
},
6464
allowed_merge_teams: b.allowed_merge_teams.clone(),
65-
allowed_merge_users: b.allowed_merge_users.clone(),
6665
merge_bots: b
6766
.merge_bots
6867
.iter()

sync-team/src/github/mod.rs

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ impl SyncGitHub {
679679
dismiss_stale_review: false,
680680
mode: rust_team_data::v1::BranchProtectionMode::PrNotRequired,
681681
allowed_merge_teams: vec![],
682-
allowed_merge_users: vec![],
683682
merge_bots: vec![],
684683
},
685684
});
@@ -717,13 +716,8 @@ impl SyncGitHub {
717716
actual_ruleset: &api::Ruleset,
718717
branch_protection: &rust_team_data::v1::BranchProtection,
719718
) -> bool {
720-
let expected_count = branch_protection.allowed_merge_teams.len()
721-
+ if branch_protection.allowed_merge_users.is_empty() {
722-
0
723-
} else {
724-
1
725-
} // OrganizationAdmin counts as 1
726-
+ branch_protection.merge_bots.len();
719+
let expected_count =
720+
branch_protection.allowed_merge_teams.len() + branch_protection.merge_bots.len();
727721

728722
let actual_count = actual_ruleset
729723
.bypass_actors
@@ -1008,24 +1002,6 @@ pub(crate) fn construct_bypass_actors(
10081002
}
10091003
}
10101004

1011-
// Add OrganizationAdmin bypass actor if allowed_merge_users is specified.
1012-
// Note: GitHub API limitation - cannot add individual users as bypass actors.
1013-
// OrganizationAdmin with actor_id=1 grants bypass to ALL organization admins.
1014-
// For granular per-user control, use allowed_merge_teams with a team containing specific users.
1015-
if !branch_protection.allowed_merge_users.is_empty() {
1016-
debug!(
1017-
"Using OrganizationAdmin bypass actor for allowed_merge_users: {:?}. \
1018-
Note: This grants bypass to ALL org admins, not just specified users. \
1019-
For per-user control, use allowed_merge_teams instead.",
1020-
branch_protection.allowed_merge_users
1021-
);
1022-
bypass_actors.push(api::RulesetBypassActor {
1023-
actor_id: Some(api::ActorId::Id(1)),
1024-
actor_type: api::RulesetActorType::OrganizationAdmin,
1025-
bypass_mode: Some(api::RulesetBypassMode::Always),
1026-
});
1027-
}
1028-
10291005
// Resolve bot integration bypass actors
10301006
for merge_bot in &branch_protection.merge_bots {
10311007
let user_login = match merge_bot {
@@ -1989,24 +1965,14 @@ fn log_ruleset(
19891965

19901966
// Log expected bypass actors if branch protection config is provided
19911967
if let Some(bp) = branch_protection
1992-
&& (!bp.allowed_merge_teams.is_empty()
1993-
|| !bp.allowed_merge_users.is_empty()
1994-
|| !bp.merge_bots.is_empty())
1968+
&& (!bp.allowed_merge_teams.is_empty() || !bp.merge_bots.is_empty())
19951969
{
19961970
writeln!(result, " Expected Bypass Actors:")?;
19971971

19981972
for team in &bp.allowed_merge_teams {
19991973
writeln!(result, " - Team: {} (Mode: always)", team)?;
20001974
}
20011975

2002-
if !bp.allowed_merge_users.is_empty() {
2003-
writeln!(
2004-
result,
2005-
" - OrganizationAdmin: ID=1 (Mode: always) [Note: Grants bypass to all org admins, requested users: {}]",
2006-
bp.allowed_merge_users.join(", ")
2007-
)?;
2008-
}
2009-
20101976
for bot in &bp.merge_bots {
20111977
let bot_name = match bot {
20121978
MergeBot::Homu => "bors",

sync-team/src/github/tests/test_utils.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ pub struct BranchProtectionBuilder {
424424
pub dismiss_stale_review: bool,
425425
pub mode: BranchProtectionMode,
426426
pub allowed_merge_teams: Vec<String>,
427-
pub allowed_merge_users: Vec<String>,
428427
pub merge_bots: Vec<MergeBot>,
429428
}
430429

@@ -449,15 +448,13 @@ impl BranchProtectionBuilder {
449448
dismiss_stale_review,
450449
mode,
451450
allowed_merge_teams,
452-
allowed_merge_users,
453451
merge_bots,
454452
} = self;
455453
v1::BranchProtection {
456454
pattern,
457455
dismiss_stale_review,
458456
mode,
459457
allowed_merge_teams,
460-
allowed_merge_users,
461458
merge_bots,
462459
}
463460
}
@@ -468,7 +465,6 @@ impl BranchProtectionBuilder {
468465
mode,
469466
dismiss_stale_review: false,
470467
allowed_merge_teams: vec![],
471-
allowed_merge_users: vec![],
472468
merge_bots: vec![],
473469
}
474470
}

tests/static-api/_expected/v1/repos.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
}
2222
},
2323
"allowed_merge_teams": [],
24-
"allowed_merge_users": [],
2524
"merge_bots": []
2625
}
2726
],
@@ -63,7 +62,6 @@
6362
"allowed_merge_teams": [
6463
"foo"
6564
],
66-
"allowed_merge_users": [],
6765
"merge_bots": []
6866
}
6967
],

tests/static-api/_expected/v1/repos/archived_repo.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
}
2020
},
2121
"allowed_merge_teams": [],
22-
"allowed_merge_users": [],
2322
"merge_bots": []
2423
}
2524
],

tests/static-api/_expected/v1/repos/some_repo.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"allowed_merge_teams": [
3131
"foo"
3232
],
33-
"allowed_merge_users": [],
3433
"merge_bots": []
3534
}
3635
],

0 commit comments

Comments
 (0)