Skip to content

Commit 286593f

Browse files
author
Silvia-Wachira
committed
update the function update_branch_protection
1 parent fbd4764 commit 286593f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ccos/norm/branch_protections.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ EXEMPT_REPOSITORIES:
1010
# special purpose repo
1111
- network-platforms
1212
# exempted for bot pushes to default branch
13-
- quantifying
13+
- quantifying:
14+
exempt_users:
15+
-bot1
16+
-bot2
1417
# special purpose repo
1518
- sre-wiki-js
1619
# special purpose repo

normalize_repos.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def update_branch_protection(repo):
110110
config = load_branch_protection_config()
111111
exempt_repositories = config["EXEMPT_REPOSITORIES"]
112112
required_status_check_map = config["REQUIRED_STATUS_CHECK_MAP"]
113+
114+
exempt_users = config.get["exempt_users, {}).get(repo.name, [])"]
115+
113116
if repo.name not in exempt_repositories and is_engineering_project(repo):
114117
LOG.info(f"{repo.name}: updating branch protections")
115118
# The following empty *_bypass_pull_request_allowance arguments ensure
@@ -121,15 +124,15 @@ def update_branch_protection(repo):
121124
required_approving_review_count=1,
122125
user_push_restrictions=[],
123126
contexts=required_status_check_map[repo.name],
124-
users_bypass_pull_request_allowances=[],
127+
users_bypass_pull_request_allowances=exempt_users,
125128
teams_bypass_pull_request_allowances=[],
126129
apps_bypass_pull_request_allowances=[],
127130
)
128131
else:
129132
default_branch.edit_protection(
130133
required_approving_review_count=1,
131134
user_push_restrictions=[],
132-
users_bypass_pull_request_allowances=[],
135+
users_bypass_pull_request_allowances=exempt_users,
133136
teams_bypass_pull_request_allowances=[],
134137
apps_bypass_pull_request_allowances=[],
135138
)

0 commit comments

Comments
 (0)