diff options
author | Steven Baumann <stevenfbaumann@gmail.com> | 2023-04-29 08:57:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-29 14:57:48 +0200 |
commit | 9c6494aca7d7f000d5a4ba597ce927c43e3b94d1 (patch) | |
tree | ed118b859b17554ab9ebd5168487c4c03799f92e | |
parent | Feature/llm data structs (#3486) (diff) | |
download | Auto-GPT-9c6494aca7d7f000d5a4ba597ce927c43e3b94d1.tar.gz Auto-GPT-9c6494aca7d7f000d5a4ba597ce927c43e3b94d1.tar.bz2 Auto-GPT-9c6494aca7d7f000d5a4ba597ce927c43e3b94d1.zip |
Fix `clone_repository` to conform to URL validation (#3150)
Co-authored-by: Reinier van der Leer <github@pwuts.nl>
-rw-r--r-- | autogpt/commands/git_operations.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/autogpt/commands/git_operations.py b/autogpt/commands/git_operations.py index fb74374cb..22233108a 100644 --- a/autogpt/commands/git_operations.py +++ b/autogpt/commands/git_operations.py @@ -11,25 +11,25 @@ CFG = Config() @command( "clone_repository", "Clone Repository", - '"repository_url": "<repository_url>", "clone_path": "<clone_path>"', + '"url": "<repository_url>", "clone_path": "<clone_path>"', CFG.github_username and CFG.github_api_key, "Configure github_username and github_api_key.", ) @validate_url -def clone_repository(repository_url: str, clone_path: str) -> str: +def clone_repository(url: str, clone_path: str) -> str: """Clone a GitHub repository locally. Args: - repository_url (str): The URL of the repository to clone. + url (str): The URL of the repository to clone. clone_path (str): The path to clone the repository to. Returns: str: The result of the clone operation. """ - split_url = repository_url.split("//") + split_url = url.split("//") auth_repo_url = f"//{CFG.github_username}:{CFG.github_api_key}@".join(split_url) try: - Repo.clone_from(auth_repo_url, clone_path) - return f"""Cloned {repository_url} to {clone_path}""" + Repo.clone_from(url=auth_repo_url, to_path=clone_path) + return f"""Cloned {url} to {clone_path}""" except Exception as e: return f"Error: {str(e)}" |