@@ -303,29 +303,46 @@ foreach ($s in $sources) {
303303 # }
304304
305305 $count ++
306-
306+
307307 # Analyze version change type
308308 $changeType = " unknown"
309309 try {
310310 # Try parsing as semantic version
311- $oldVer = [System.Version ]::Parse($s.version.Split (' -' )[0 ])
312- $newVer = [System.Version ]::Parse($version.Split (' -' )[0 ])
313-
314- if ($newVer.Major -gt $oldVer.Major ) {
315- $changeType = " major"
316- $hasBreakingChanges = $true
317- } elseif ($newVer.Minor -gt $oldVer.Minor ) {
318- $changeType = " minor"
311+ # Handle versions with more than 4 parts by taking only the first 3-4 parts
312+ $oldVerStr = $s.version.Split (' -' )[0 ]
313+ $newVerStr = $version.Split (' -' )[0 ]
314+
315+ # Split by dots and take only numeric parts, first 4 max
316+ $oldParts = $oldVerStr.Split (' .' ) | Where-Object { $_ -match ' ^\d+$' } | Select-Object - First 4
317+ $newParts = $newVerStr.Split (' .' ) | Where-Object { $_ -match ' ^\d+$' } | Select-Object - First 4
318+
319+ # Ensure we have at least 2 parts (major.minor)
320+ if ($oldParts.Count -ge 2 -and $newParts.Count -ge 2 ) {
321+ $oldVerParseable = $oldParts -join ' .'
322+ $newVerParseable = $newParts -join ' .'
323+
324+ $oldVer = [System.Version ]::Parse($oldVerParseable )
325+ $newVer = [System.Version ]::Parse($newVerParseable )
326+
327+ if ($newVer.Major -gt $oldVer.Major ) {
328+ $changeType = " major"
329+ $hasBreakingChanges = $true
330+ } elseif ($newVer.Minor -gt $oldVer.Minor ) {
331+ $changeType = " minor"
332+ } else {
333+ $changeType = " patch"
334+ }
319335 } else {
320- $changeType = " patch"
336+ # Not enough numeric parts for semantic versioning
337+ throw " Not enough numeric version parts"
321338 }
322339 } catch {
323340 # If semantic versioning fails, treat as unknown (potentially breaking)
324341 $changeType = " unknown"
325342 $hasBreakingChanges = $true
326343 Write-Verbose " Could not parse version as semantic version, treating as potentially breaking"
327344 }
328-
345+
329346 $updateDetails += @ {
330347 name = $s.name
331348 oldVersion = $s.version
0 commit comments