diff --git a/unhacs/git.py b/unhacs/git.py index 8fb9838..96f0308 100644 --- a/unhacs/git.py +++ b/unhacs/git.py @@ -84,5 +84,10 @@ def get_latest_sha(repository_url: str, branch_name: str) -> str: raise ValueError(f"branch name '{branch_name}' not found for {repository_url}") -def get_ref_zip(repository_url: str, tag_name: str) -> str: +def get_tag_zip(repository_url: str, tag_name: str) -> str: return f"{repository_url}/archive/refs/tags/{tag_name}.zip" + +def get_branch_zip(repository_url: str, branch_name: str) -> str: + return f"{repository_url}/archive/{branch_name}.zip" + + diff --git a/unhacs/packages.py b/unhacs/packages.py index 70c76a7..28f530e 100644 --- a/unhacs/packages.py +++ b/unhacs/packages.py @@ -14,7 +14,7 @@ import requests import yaml from unhacs.git import get_latest_sha -from unhacs.git import get_ref_zip +from unhacs.git import get_tag_zip from unhacs.git import get_repo_tags DEFAULT_HASS_CONFIG_PATH: Path = Path(".") @@ -235,7 +235,7 @@ class Package: def install_integration(self, hass_config_path: Path): """Installs the integration package.""" - zipball_url = get_ref_zip(self.url, self.version) + zipball_url = get_tag_zip(self.url, self.version) response = requests.get(zipball_url) response.raise_for_status() @@ -266,7 +266,7 @@ class Package: def install_fork_component(self, hass_config_path: Path): """Installs the integration from hass fork.""" assert self.fork_component - zipball_url = get_ref_zip(self.url, self.version) + zipball_url = get_tag_zip(self.url, self.version) response = requests.get(zipball_url) response.raise_for_status()