SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
fix: strip .git suffix when parsing github repo url (#1442)
Anas Khan5f40e63360d6
diff --git a/sweagent/utils/github.py b/sweagent/utils/github.pyindex 25b1c8b3..425fae87 100644--- a/sweagent/utils/github.py+++ b/sweagent/utils/github.py@@ -82,9 +82,8 @@ def _parse_gh_repo_url(repo_url: str) -> tuple[str, str]:if not match:msg = f"Invalid GitHub issue URL: {repo_url}"raise InvalidGithubURL(msg)- res = match.groups()- assert len(res) == 2- return tuple(res) # type: ignore+ owner, repo = match.groups()+ return owner, repo.removesuffix(".git")def _get_gh_issue_data(issue_url: str, *, token: str = ""):diff --git a/tests/test_env_utils.py b/tests/test_env_utils.pyindex 03b17674..c0cc2db5 100644--- a/tests/test_env_utils.py+++ b/tests/test_env_utils.py@@ -39,6 +39,8 @@ def test_parse_gh_repo_url():assert _parse_gh_repo_url("github.com/SWE-agent/SWE-agent") == ("SWE-agent", "SWE-agent")assert _parse_gh_repo_url("github.com/SWE-agent/SWE-agent/asdfjsdfg") == ("SWE-agent", "SWE-agent")assert _parse_gh_repo_url("[email protected]/SWE-agent/SWE-agent/asdfjsdfg") == ("SWE-agent", "SWE-agent")+ assert _parse_gh_repo_url("https://github.com/SWE-agent/SWE-agent.git") == ("SWE-agent", "SWE-agent")+ assert _parse_gh_repo_url("github.com/SWE-agent/SWE-agent.git") == ("SWE-agent", "SWE-agent")def test_parse_gh_repo_url_fails():