From 09cff2ee2c37f4951186efd795b935deb09ec8dc Mon Sep 17 00:00:00 2001 From: Corentin Forler Date: Thu, 19 Sep 2024 09:50:02 +0200 Subject: [PATCH] refactor: Keep _get_repo_url DRY --- press/press/doctype/app_release/app_release.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/press/press/doctype/app_release/app_release.py b/press/press/doctype/app_release/app_release.py index 13d5f8993e..da86b63ce8 100644 --- a/press/press/doctype/app_release/app_release.py +++ b/press/press/doctype/app_release/app_release.py @@ -11,7 +11,6 @@ import frappe from frappe.model.document import Document -from press.api.github import get_access_token from press.press.doctype.app_source.app_source import AppSource from press.utils import log_error @@ -222,15 +221,7 @@ def _clone_repo(self): self.output += self.run(f"git reset --hard {self.hash}") def _get_repo_url(self, source: "AppSource") -> str: - if not source.github_installation_id: - return source.repository_url - - token = get_access_token(source.github_installation_id) - if token is None: - # Do not edit without updating deploy_notifications.py - raise Exception("App installation token could not be fetched", self.app) - - return f"https://x-access-token:{token}@github.com/{source.repository_owner}/{source.repository}" + return source.get_repo_url() def on_trash(self): if self.clone_directory and os.path.exists(self.clone_directory):