@@ -110,6 +110,9 @@ def update_branch_protection(repo):
110
110
config = load_branch_protection_config ()
111
111
exempt_repositories = config ["EXEMPT_REPOSITORIES" ]
112
112
required_status_check_map = config ["REQUIRED_STATUS_CHECK_MAP" ]
113
+
114
+ exempt_users = config .get ("EXEMPT_USERS" , {}).get (repo .name , [])
115
+
113
116
if repo .name not in exempt_repositories and is_engineering_project (repo ):
114
117
LOG .info (f"{ repo .name } : updating branch protections" )
115
118
# The following empty *_bypass_pull_request_allowance arguments ensure
@@ -121,15 +124,15 @@ def update_branch_protection(repo):
121
124
required_approving_review_count = 1 ,
122
125
user_push_restrictions = [],
123
126
contexts = required_status_check_map [repo .name ],
124
- users_bypass_pull_request_allowances = [] ,
127
+ users_bypass_pull_request_allowances = exempt_users ,
125
128
teams_bypass_pull_request_allowances = [],
126
129
apps_bypass_pull_request_allowances = [],
127
130
)
128
131
else :
129
132
default_branch .edit_protection (
130
133
required_approving_review_count = 1 ,
131
134
user_push_restrictions = [],
132
- users_bypass_pull_request_allowances = [] ,
135
+ users_bypass_pull_request_allowances = exempt_users ,
133
136
teams_bypass_pull_request_allowances = [],
134
137
apps_bypass_pull_request_allowances = [],
135
138
)
@@ -140,6 +143,7 @@ def update_branch_protection(repo):
140
143
def update_branches (args , repos ):
141
144
if args .skip_branches :
142
145
return
146
+
143
147
LOG .info ("Evaluting repositories for branch protections..." )
144
148
for repo in repos :
145
149
update_branch_protection (repo )
0 commit comments