From 0ea05b9f668199a4cef6dcbd6c808f0a20961e58 Mon Sep 17 00:00:00 2001 From: Alexis Date: Thu, 26 Mar 2026 08:57:57 -0400 Subject: [PATCH 1/2] Fix regression in #14546 --- .github/bin/bump_dependency.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/bin/bump_dependency.py b/.github/bin/bump_dependency.py index 76769ddab12e..c08a298cdb63 100644 --- a/.github/bin/bump_dependency.py +++ b/.github/bin/bump_dependency.py @@ -13,11 +13,6 @@ def get_remote_commit_sha(repo_url: str, branch: str) -> str: return output.split("\t")[0] -def _version_key(tag: str) -> tuple[int, ...]: - version = tag.lstrip("v") - return tuple(map(int, version.split("."))) - - def get_remote_latest_tag(repo_url: str, tag_pattern: str) -> str: output = subprocess.check_output( ["git", "ls-remote", "--tags", repo_url], text=True @@ -33,15 +28,20 @@ def get_remote_latest_tag(repo_url: str, tag_pattern: str) -> str: if re.match(tag_pattern + "$", tag): tags.append(tag) - return sorted(tags, key=_version_key)[-1] + def version_key(tag: str) -> tuple[int, ...]: + version = tag.lstrip("v") + return tuple(map(int, version.split("."))) + + return sorted(tags, key=version_key)[-1] -def get_current_version_from_file(file_path: str, pattern: str) -> str: +def get_current_versions_from_file( + file_path: str, pattern: str +) -> list[str]: with open(file_path) as f: content = f.read() - matches = re.findall(pattern, content) - return min(matches, key=_version_key) + return re.findall(pattern, content) def update_file_version( @@ -149,22 +149,23 @@ def main() -> int: args = parser.parse_args() - current_version = get_current_version_from_file( - args.file_path, args.current_version_pattern - ) - if args.tag: latest_version = get_remote_latest_tag(args.repo_url, args.tag_pattern) else: latest_version = get_remote_commit_sha(args.repo_url, args.branch) - if current_version == latest_version: - print(f"{args.name}: No update needed (current: {current_version})") + current_versions = get_current_versions_from_file( + args.file_path, args.current_version_pattern + ) + + if all(v == latest_version for v in current_versions): + print(f"{args.name}: No update needed (current: {latest_version})") if not args.commit_message_fd: with open(os.environ["GITHUB_OUTPUT"], "a") as f: f.write("HAS_UPDATES=false\n") return 0 + current_version = current_versions[0] print( f"{args.name}: Update available " f"({current_version} -> {latest_version})" From 22f55d039f892b696d006d585536a6c3c36d4176 Mon Sep 17 00:00:00 2001 From: Alexis Date: Thu, 26 Mar 2026 09:28:09 -0400 Subject: [PATCH 2/2] Update current_version --- .github/bin/bump_dependency.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/bin/bump_dependency.py b/.github/bin/bump_dependency.py index c08a298cdb63..4840e2c3aeb9 100644 --- a/.github/bin/bump_dependency.py +++ b/.github/bin/bump_dependency.py @@ -35,9 +35,7 @@ def version_key(tag: str) -> tuple[int, ...]: return sorted(tags, key=version_key)[-1] -def get_current_versions_from_file( - file_path: str, pattern: str -) -> list[str]: +def get_current_versions_from_file(file_path: str, pattern: str) -> list[str]: with open(file_path) as f: content = f.read() @@ -165,7 +163,7 @@ def main() -> int: f.write("HAS_UPDATES=false\n") return 0 - current_version = current_versions[0] + current_version = next(v for v in current_versions if v != latest_version) print( f"{args.name}: Update available " f"({current_version} -> {latest_version})"