Skip to content

Commit

Permalink
Add validation for allowed-merge-teams
Browse files Browse the repository at this point in the history
It seems that teams mentioned in this array have to also have explicit access to the repository, otherwise configuration of the allowed merge teams will not work in `sync-team`.
  • Loading branch information
Kobzol committed Mar 7, 2025
1 parent efc01a8 commit da7046f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/toml-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ required-approvals = 1
# Which GitHub teams have access to push/merge to this branch.
# If unspecified, all teams/contributors with write or higher access
# can push/merge to the branch.
# Teams mentioned in this array must also have access to the repo
# in [access.teams].
# (optional)
allowed-merge-teams = ["awesome-team"]
# Determines the merge queue bot(s) that manage pushes to this branch.
Expand Down
9 changes: 9 additions & 0 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,15 @@ but that team does not seem to exist"#,
team
);
}
if !repo.access.teams.contains_key(team) {
bail!(
r#"repo '{}' uses a branch protection for {} that has an allowed merge team '{}',
but that team is not mentioned in [access.teams]"#,
repo.name,
protection.pattern,
team
);
}
}

if !protection.pr_required {
Expand Down

0 comments on commit da7046f

Please sign in to comment.