From 5f5eac61e3824739bca34e06e439208f81b55773 Mon Sep 17 00:00:00 2001 From: Eddie Cohen Date: Thu, 13 Apr 2023 22:37:22 -0400 Subject: [PATCH] clone repo method --- scripts/git_operations.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/git_operations.py diff --git a/scripts/git_operations.py b/scripts/git_operations.py new file mode 100644 index 00000000..3309192c --- /dev/null +++ b/scripts/git_operations.py @@ -0,0 +1,13 @@ +import git +from config import Config + +cfg = Config() + +def clone_repository(repo_url, clone_path): + """Clone a github repository locally""" + split_url = repo_url.split("//") + auth_repo_url = f"//{cfg.github_username}:{cfg.github_api_key}@".join(split_url) + git.Repo.clone_from(auth_repo_url, clone_path) + result = f"""Cloned {repo_url} to {clone_path}""" + + return result \ No newline at end of file