Skip to content

feat(settings.py): Now compares all settings #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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