From db9687a8387e1095b2ad846140c2a59266bfca6b Mon Sep 17 00:00:00 2001 From: Morg42 <43153739+Morg42@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:43:07 +0100 Subject: [PATCH] githubplugin: fix dir scanning for branches with underscores --- githubplugin/__init__.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/githubplugin/__init__.py b/githubplugin/__init__.py index 2f8fcf808..d6bfbc9a0 100644 --- a/githubplugin/__init__.py +++ b/githubplugin/__init__.py @@ -106,9 +106,12 @@ def login(self): if auth: self._github.get_user().login + + if not self._github: + raise GPError('setup/login failed') except Exception as e: self._github = None - raise GPError(e) + self.loggerr(f'could not initialize Github object: {e}') def get_rate_limit(self): """ return list of allowed and remaining requests and backoff seconds """ @@ -127,7 +130,7 @@ def get_rate_limit(self): def get_repo(self, user, repo): if not self._github: - self.loggerr('error: Github object not initialized') + self.login() try: return self._github.get_repo(f'{user}/{repo}') @@ -136,16 +139,14 @@ def get_repo(self, user, repo): def set_repo(self) -> bool: if not self._github: - self.loggerr('error: Github object not initialized') - return False + self.login() self.git_repo = self.get_repo('smarthomeNG', self.repo) return True def get_pulls(self, fetch=False) -> bool: if not self._github: - self.loggerr('error: Github object not initialized') - return False + self.login() if not self.git_repo: self.set_repo() @@ -172,8 +173,7 @@ def get_pulls(self, fetch=False) -> bool: def get_forks(self, fetch=False) -> bool: if not self._github: - self.loggerr('error: Github object not initialized') - return False + self.login() if not self.git_repo: self.set_repo() @@ -346,7 +346,7 @@ def read_repos_from_dir(self): try: # owner_wt_branch - owner, _, branch = wt.split('_') + owner, branch = wt.split('_wt_') except Exception: self.logger.debug(f'ignoring {target}, not in priv_repos/*_wt_*/plugin form ') continue