From 6167ac4e834a25e14867aafd419bd9b644bfa6e4 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 23 May 2026 22:44:37 +0200 Subject: github: fix parameter passing --- cgitize/github.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cgitize/github.py b/cgitize/github.py index 666451f..b03e085 100644 --- a/cgitize/github.py +++ b/cgitize/github.py @@ -27,15 +27,22 @@ class GitHub: def get_user_repos(self, user, visibility=Visibility.ALL): visibility = visibility.to_github_arg() + + # Not actually certain how it works, but just passing None as the + # named visibility parameter fails with an internal assert error. I + # honestly thought that that passing parameters like that and as a + # None makes no difference. + kwargs = {} + if visibility is not None: + kwargs['visibility'] = visibility + try: if user.name == self._username: # To get private repositories, get_user() must be called # without arguments: - return self._impl.get_user().get_repos( - affiliation='owner', visibility=visibility - ) + return self._impl.get_user().get_repos(affiliation='owner', **kwargs) else: - return self._impl.get_user(user.name).get_repos(visibility=visibility) + return self._impl.get_user(user.name).get_repos(**kwargs) except GithubException: logging.error("Couldn't fetch user repositories: %s", user.name) raise -- cgit v1.3