moved file

This commit is contained in:
brb
2023-07-06 10:57:05 +02:00
parent b2bb34250b
commit 65d2e850b5
+16
View File
@@ -0,0 +1,16 @@
from pydantic import AnyHttpUrl
from pathlib import Path
from git import Repo
import shutil
def clone_repository(repo_url: AnyHttpUrl) -> Path:
# extract repo name
repo_name = repo_url.split('/')[-1].replace('.git', '')
dst_dir = Path(__file__).parent / repo_name
# prepare repo download dir
if dst_dir.exists():
shutil.rmtree(dst_dir)
dst_dir.mkdir()
# git clone repo
Repo.clone_from(url=repo_url, to_path=dst_dir)
return dst_dir