Skip to content

Commit

Permalink
feat(settings.py): Now compares all settings (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiro authored May 25, 2023
1 parent 4af6c09 commit 441b8e4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions repo_manager/github/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,20 @@ def get_repo_value(setting_name: str, repo: Repository) -> Any | None:
checked = True
for setting_name in settings.dict().keys():
repo_value = get_repo_value(setting_name, repo)
if repo_value is None:
continue
settings_value = getattr(settings, setting_name)
# These don't seem to update if changed; may need to explore a different API call
if ((setting_name == "enable_automated_security_fixes") | (setting_name == "enable_vulnerability_alerts")):
continue
# We don't want to flag description being different if the YAML is None
if (setting_name == "description") & (not settings_value):
continue
elif (setting_name == "topics") & (settings_value is None):
settings_value = []
if repo_value != settings_value:
drift.append(f"{setting_name} -- Expected: '{settings_value}' Found: '{repo_value}'")
checked = False
checked &= False if (settings_value is not None) else True
return checked, drift


def update(repo: Repository, setting_name: str, new_value: Any):
"""[summary]
Expand Down

0 comments on commit 441b8e4

Please sign in to comment.