Skip to content

Commit

Permalink
Merge pull request #1690 from Kobzol/validate-allowed-merge-teams
Browse files Browse the repository at this point in the history
Add validation for `allowed-merge-teams`
  • Loading branch information
marcoieni authored Mar 7, 2025
2 parents efc01a8 + da7046f commit 3e2bedf
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 3e2bedf

Please sign in to comment.