@@ -35,12 +35,11 @@ def version_key(tag: str) -> tuple[int, ...]:
3535 return sorted (tags , key = version_key )[- 1 ]
3636
3737
38- def get_current_version_from_file (file_path : str , pattern : str ) -> str :
38+ def get_current_versions_from_file (file_path : str , pattern : str ) -> list [ str ] :
3939 with open (file_path ) as f :
4040 content = f .read ()
4141
42- match = re .search (pattern , content )
43- return match .group (1 )
42+ return re .findall (pattern , content )
4443
4544
4645def update_file_version (
@@ -148,22 +147,23 @@ def main() -> int:
148147
149148 args = parser .parse_args ()
150149
151- current_version = get_current_version_from_file (
152- args .file_path , args .current_version_pattern
153- )
154-
155150 if args .tag :
156151 latest_version = get_remote_latest_tag (args .repo_url , args .tag_pattern )
157152 else :
158153 latest_version = get_remote_commit_sha (args .repo_url , args .branch )
159154
160- if current_version == latest_version :
161- print (f"{ args .name } : No update needed (current: { current_version } )" )
155+ current_versions = get_current_versions_from_file (
156+ args .file_path , args .current_version_pattern
157+ )
158+
159+ if all (v == latest_version for v in current_versions ):
160+ print (f"{ args .name } : No update needed (current: { latest_version } )" )
162161 if not args .commit_message_fd :
163162 with open (os .environ ["GITHUB_OUTPUT" ], "a" ) as f :
164163 f .write ("HAS_UPDATES=false\n " )
165164 return 0
166165
166+ current_version = next (v for v in current_versions if v != latest_version )
167167 print (
168168 f"{ args .name } : Update available "
169169 f"({ current_version } -> { latest_version } )"
0 commit comments