From da2c89558d06dbf1490bb2f89b445dcc7801c4d0 Mon Sep 17 00:00:00 2001 From: Suhas Thalanki Date: Thu, 12 Feb 2026 10:56:08 -0800 Subject: [PATCH 1/3] make regex more lenient --- release-pr/src/neon_release_pr/git.py | 2 +- release-pr/tests/test_origin_url_regex.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/release-pr/src/neon_release_pr/git.py b/release-pr/src/neon_release_pr/git.py index 97915cee..95b732b1 100644 --- a/release-pr/src/neon_release_pr/git.py +++ b/release-pr/src/neon_release_pr/git.py @@ -175,7 +175,7 @@ def github_repo(origin_url: str | None) -> str | None: if origin_url is None: return None - match = re.search(r"github.com[:\d/]+?(?P[^/]+?/[^/]+?)(\.git)?$", origin_url) + match = re.search(r"github[^:/\s]*\.com[^:/\s]*[:\/](?P[^/]+?/[^/]+?)(\.git)?$", origin_url) assert match, ( "There should be exactly one repo owner/name match in the url for remote origin" diff --git a/release-pr/tests/test_origin_url_regex.py b/release-pr/tests/test_origin_url_regex.py index f4691b99..5bdfa2e3 100644 --- a/release-pr/tests/test_origin_url_regex.py +++ b/release-pr/tests/test_origin_url_regex.py @@ -2,10 +2,15 @@ def test_round_trip_parse_then_generate(): - for url in [ - "https://github.com/databricks-eng/hadron.git", - "git@github.com:neondatabase/neon.git", - "ssh://git@github.com:22/neondatabase/neon.git", - "https://github.com/databricks-eng/hadron", - ]: - assert git.github_repo(url) is not None, f"No match for url {url}" + test_cases = [ + ("https://github.com/databricks-eng/hadron.git", "databricks-eng/hadron"), + ("git@github.com:neondatabase/neon.git", "neondatabase/neon"), + ("ssh://git@github.com:22/neondatabase/neon.git", "neondatabase/neon"), + ("https://github.com/databricks-eng/hadron", "databricks-eng/hadron"), + ("git@github-neon.com:neondatabase/dev-actions.git", "neondatabase/dev-actions"), + ("git@github.com-emu:databricks-eng/hadron.git", "databricks-eng/hadron"), + ("git@github-neon.com:neondatabase/dev-actions.git", "neondatabase/dev-actions"), + ("git@github.com-emu:databricks-eng/hadron.git", "databricks-eng/hadron"), + ] + for url, expected_repo in test_cases: + assert git.github_repo(url) == expected_repo, f"Expected {expected_repo} for url {url}" From 5b3a6fe35633e34cba55104be1a83b6430542f30 Mon Sep 17 00:00:00 2001 From: Suhas Thalanki Date: Thu, 12 Feb 2026 11:02:25 -0800 Subject: [PATCH 2/3] fmt and test fix --- release-pr/src/neon_release_pr/git.py | 5 ++++- release-pr/tests/test_origin_url_regex.py | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/release-pr/src/neon_release_pr/git.py b/release-pr/src/neon_release_pr/git.py index 95b732b1..8d6c639f 100644 --- a/release-pr/src/neon_release_pr/git.py +++ b/release-pr/src/neon_release_pr/git.py @@ -175,7 +175,10 @@ def github_repo(origin_url: str | None) -> str | None: if origin_url is None: return None - match = re.search(r"github[^:/\s]*\.com[^:/\s]*[:\/](?P[^/]+?/[^/]+?)(\.git)?$", origin_url) + match = re.search( + r"github[^:/\s]*\.com[^:/\s]*(?::\d+)?[:\/](?P[^/]+?/[^/]+?)(\.git)?$", + origin_url, + ) assert match, ( "There should be exactly one repo owner/name match in the url for remote origin" diff --git a/release-pr/tests/test_origin_url_regex.py b/release-pr/tests/test_origin_url_regex.py index 5bdfa2e3..976a12da 100644 --- a/release-pr/tests/test_origin_url_regex.py +++ b/release-pr/tests/test_origin_url_regex.py @@ -7,10 +7,18 @@ def test_round_trip_parse_then_generate(): ("git@github.com:neondatabase/neon.git", "neondatabase/neon"), ("ssh://git@github.com:22/neondatabase/neon.git", "neondatabase/neon"), ("https://github.com/databricks-eng/hadron", "databricks-eng/hadron"), - ("git@github-neon.com:neondatabase/dev-actions.git", "neondatabase/dev-actions"), + ( + "git@github-neon.com:neondatabase/dev-actions.git", + "neondatabase/dev-actions", + ), ("git@github.com-emu:databricks-eng/hadron.git", "databricks-eng/hadron"), - ("git@github-neon.com:neondatabase/dev-actions.git", "neondatabase/dev-actions"), + ( + "git@github-neon.com:neondatabase/dev-actions.git", + "neondatabase/dev-actions", + ), ("git@github.com-emu:databricks-eng/hadron.git", "databricks-eng/hadron"), ] for url, expected_repo in test_cases: - assert git.github_repo(url) == expected_repo, f"Expected {expected_repo} for url {url}" + assert git.github_repo(url) == expected_repo, ( + f"Expected {expected_repo} for url {url}" + ) From 41086f888339ea9e935424f9f54af2de927717da Mon Sep 17 00:00:00 2001 From: Suhas Thalanki Date: Thu, 12 Feb 2026 13:08:51 -0800 Subject: [PATCH 3/3] update test --- release-pr/tests/test_origin_url_regex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-pr/tests/test_origin_url_regex.py b/release-pr/tests/test_origin_url_regex.py index 976a12da..ff702ff8 100644 --- a/release-pr/tests/test_origin_url_regex.py +++ b/release-pr/tests/test_origin_url_regex.py @@ -13,7 +13,7 @@ def test_round_trip_parse_then_generate(): ), ("git@github.com-emu:databricks-eng/hadron.git", "databricks-eng/hadron"), ( - "git@github-neon.com:neondatabase/dev-actions.git", + "ssh://git@github-neon.com:22/neondatabase/dev-actions.git", "neondatabase/dev-actions", ), ("git@github.com-emu:databricks-eng/hadron.git", "databricks-eng/hadron"),