Skip to content

Commit da648be

Browse files
committed
Fix missing branch_protections.yaml path error
1 parent cf18dcf commit da648be

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

normalize_repos.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def is_engineering_project(repo):
9393

9494

9595
def load_branch_protection_config():
96-
with open('branch_protections.yaml', 'r') as file:
96+
with open("branch_protections.yml", "r") as file:
9797
config = yaml.safe_load(file)
9898
return config
9999

@@ -108,12 +108,9 @@ def update_branch_protection(repo):
108108
else:
109109
raise
110110
config = load_branch_protection_config()
111-
exempt_repositories = config['EXEMPT_REPOSITORIES']
112-
required_status_check_map = config['REQUIRED_STATUS_CHECK_MAP']
113-
if (
114-
repo.name not in exempt_repositories
115-
and is_engineering_project(repo)
116-
):
111+
exempt_repositories = config["EXEMPT_REPOSITORIES"]
112+
required_status_check_map = config["REQUIRED_STATUS_CHECK_MAP"]
113+
if repo.name not in exempt_repositories and is_engineering_project(repo):
117114
LOG.info(f"{repo.name}: updating branch protections")
118115
# The following empty *_bypass_pull_request_allowance arguments ensure
119116
# the required bypass_pull_request_allowances API parameter is
@@ -123,9 +120,7 @@ def update_branch_protection(repo):
123120
default_branch.edit_protection(
124121
required_approving_review_count=1,
125122
user_push_restrictions=[],
126-
contexts=required_status_check_map[
127-
repo.name
128-
],
123+
contexts=required_status_check_map[repo.name],
129124
users_bypass_pull_request_allowances=[],
130125
teams_bypass_pull_request_allowances=[],
131126
apps_bypass_pull_request_allowances=[],

0 commit comments

Comments
 (0)