Skip to content

Commit c66c639

Browse files
committed
Refactor protected paths in CODEOWNERS generation
1 parent 23be760 commit c66c639

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/ci.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ pub fn check_codeowners(data: Data) -> anyhow::Result<()> {
2525
Ok(())
2626
}
2727

28+
/// Sensitive TOML data files.
29+
/// PRs that modify them need to be approved by an infra-admin.
30+
const PROTECTED_PATHS: &[&str] = &[
31+
"/repos/rust-lang/team.toml",
32+
"/repos/rust-lang/sync-team.toml",
33+
"/teams/infra-admins.toml",
34+
"/teams/team-repo-admins.toml",
35+
];
36+
2837
/// We want to allow access to the data files to `team-repo-admins`
2938
/// (maintainers), while requiring a review from `infra-admins` (admins)
3039
/// for any other changes.
@@ -137,12 +146,8 @@ teams/**/*.toml
137146
)
138147
.unwrap();
139148

140-
let mut protected_paths = vec![
141-
"/repos/rust-lang/team.toml".to_string(),
142-
"/repos/rust-lang/sync-team.toml".to_string(),
143-
"/teams/infra-admins.toml".to_string(),
144-
"/teams/team-repo-admins.toml".to_string(),
145-
];
149+
let mut protected_paths: Vec<String> =
150+
PROTECTED_PATHS.iter().map(|&p| String::from(p)).collect();
146151

147152
// Some users can be both admins and maintainers.
148153
let all_users = admins

0 commit comments

Comments
 (0)