ci
ci copied to clipboard
fix: use semantic versioning for version comparisons in check-images-internal.ts
String-based version comparison is unreliable for semantic versions. For example, "v8.5.10" <= "v8.5.3" incorrectly returns true because "1" < "3" lexicographically.
Changes
- Import
@std/semver(already used elsewhere in this repo) - Add
normalizeVersion()to stripvprefix and-enterprisesuffix - Add
versionGreaterOrEqual()andversionLessThanOrEqual()helper functions - Replace all three string comparisons with semver-based comparisons
Example
// Before (buggy)
if (version <= "v8.5.3" && gitRepo === "pingcap/ticdc") { ... }
// After (correct)
if (versionLessThanOrEqual(version, "v8.5.3") && gitRepo === "pingcap/ticdc") { ... }
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.