Skip to content

Commit

Permalink
refactor: Keep _get_repo_url DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
cogk committed Sep 19, 2024
1 parent 465cdab commit 09cff2e
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions press/press/doctype/app_release/app_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 09cff2e

Please sign in to comment.