Skip to content

Commit da7046f

Browse files
committed
Add validation for allowed-merge-teams
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`.
1 parent efc01a8 commit da7046f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/toml-schema.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ required-approvals = 1
350350
# Which GitHub teams have access to push/merge to this branch.
351351
# If unspecified, all teams/contributors with write or higher access
352352
# can push/merge to the branch.
353+
# Teams mentioned in this array must also have access to the repo
354+
# in [access.teams].
353355
# (optional)
354356
allowed-merge-teams = ["awesome-team"]
355357
# Determines the merge queue bot(s) that manage pushes to this branch.

src/validate.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,15 @@ but that team does not seem to exist"#,
840840
team
841841
);
842842
}
843+
if !repo.access.teams.contains_key(team) {
844+
bail!(
845+
r#"repo '{}' uses a branch protection for {} that has an allowed merge team '{}',
846+
but that team is not mentioned in [access.teams]"#,
847+
repo.name,
848+
protection.pattern,
849+
team
850+
);
851+
}
843852
}
844853

845854
if !protection.pr_required {

0 commit comments

Comments
 (0)