Skip to content

Commit

Permalink
fix(github_nulls): Better handling of Nulls in GitHub API (#39)
Browse files Browse the repository at this point in the history
* fix(branch_protections.py): Handle null GitHub Elements

Corrects issue where GitHub repo currently contains no elements, but config file does

* fix(branch_protections.py): Handle null GitHub Elements
  • Loading branch information
shiro authored May 25, 2023
1 parent 4d4c44f commit 6744d11
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions repo_manager/github/branch_protections.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,27 @@ def check_repo_branch_protections(
diff_option(
"required_approving_review_count",
config_bp.protection.pr_options.required_approving_review_count,
this_protection.required_pull_request_reviews.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,
)
)
diffs.append(
diff_option(
"dismiss_stale_reviews",
config_bp.protection.pr_options.dismiss_stale_reviews,
this_protection.required_pull_request_reviews.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,
)
)
diffs.append(
diff_option(
"require_code_owner_reviews",
config_bp.protection.pr_options.require_code_owner_reviews,
this_protection.required_pull_request_reviews.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,
)
)
# for now, not checking dismissal options. Will note that in the docs
Expand Down

0 comments on commit 6744d11

Please sign in to comment.