Skip to content

Commit

Permalink
fix(branch_protection): fix false to False
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewthetechie committed May 25, 2023
1 parent 33090f5 commit c4a164d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions repo_manager/github/branch_protections.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def edit_protection( # nosec
post_parameters["required_status_checks"] = required_status_checks
else:
post_parameters["required_status_checks"] = {
"strict": false,
"strict": False,
"contexts": [],
}

Expand Down Expand Up @@ -282,26 +282,29 @@ def check_repo_branch_protections(
"required_approving_review_count",
config_bp.protection.pr_options.required_approving_review_count,
## Had issues when the YAML defines this but the Repo has none (e.g. it's null in the cloud)
None if (this_protection.required_pull_request_reviews is None) else \
this_protection.required_pull_request_reviews.required_approving_review_count,
None
if (this_protection.required_pull_request_reviews is None)
else this_protection.required_pull_request_reviews.required_approving_review_count,
)
)
diffs.append(
diff_option(
"dismiss_stale_reviews",
config_bp.protection.pr_options.dismiss_stale_reviews,
## Had issues when the YAML defines this but the Repo has none (e.g. it's null in the cloud)
None if (this_protection.required_pull_request_reviews is None) else \
this_protection.required_pull_request_reviews.dismiss_stale_reviews,
None
if (this_protection.required_pull_request_reviews is None)
else this_protection.required_pull_request_reviews.dismiss_stale_reviews,
)
)
diffs.append(
diff_option(
"require_code_owner_reviews",
config_bp.protection.pr_options.require_code_owner_reviews,
## Had issues when the YAML defines this but the Repo has none (e.g. it's null in the cloud)
None if (this_protection.required_pull_request_reviews is None) else \
this_protection.required_pull_request_reviews.require_code_owner_reviews,
None
if (this_protection.required_pull_request_reviews is None)
else this_protection.required_pull_request_reviews.require_code_owner_reviews,
)
)
# for now, not checking dismissal options. Will note that in the docs
Expand All @@ -318,9 +321,9 @@ def check_repo_branch_protections(
)
)
# Without sorting, they sometimes get flagged as different just due to the ordinality of them
if (config_bp.protection.required_status_checks.checks is not None):
if config_bp.protection.required_status_checks.checks is not None:
config_bp.protection.required_status_checks.checks.sort()
if (this_protection.required_status_checks.contexts is not None):
if this_protection.required_status_checks.contexts is not None:
this_protection.required_status_checks.contexts.sort()
diffs.append(
diff_option(
Expand Down

0 comments on commit c4a164d

Please sign in to comment.