Skip to content

Commit b1cf92c

Browse files
committed
ci: Fix version parsing
Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 2f4a98f commit b1cf92c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/module-monitor.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,22 @@ jobs:
9191
if version_str == 'N/A':
9292
return version_str
9393
94-
# Simply reverse the order of version components
94+
# Version format should be FAMILY.MAJOR.MINOR.PATCH
95+
# If the version appears reversed (PATCH.MINOR.MAJOR.FAMILY), fix it
9596
parts = version_str.split('.')
9697
if len(parts) >= 4:
97-
# Reverse the parts
98-
parts = parts[::-1]
99-
return '.'.join(parts)
98+
# Check if this looks like a reversed version (patch.min.maj.fam -> fam.maj.min.patch)
99+
# If the first part is larger than the last part, it's likely reversed
100+
try:
101+
first_part = int(parts[0])
102+
last_part = int(parts[-1])
103+
if first_part > last_part:
104+
# Reverse the parts to get FAMILY.MAJOR.MINOR.PATCH
105+
parts = parts[::-1]
106+
return '.'.join(parts)
107+
except ValueError:
108+
# If we can't parse as integers, return as is
109+
pass
100110
101111
return version_str
102112

0 commit comments

Comments
 (0)