Fix: Handle non-semver branch versions like releases/26.x in GetLatestRelease#2112
Fix: Handle non-semver branch versions like releases/26.x in GetLatestRelease#2112
Conversation
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
|
@copilot can you also please add release notes entry |
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where CI/CD workflows fail on branches with non-semantic version names like releases/26.x, which couldn't be parsed as valid semantic versions. The fix introduces logic to strip the .x suffix and handle major-only version patterns (e.g., 26.x → match all 26.*.* releases) separately from major.minor patterns (e.g., 26.3 → match all 26.3.* releases).
Changes:
- Strip
.xsuffix from branch versions before parsing - Add support for major-only version matching (e.g.,
releases/26.xorreleases/26) - Maintain existing major.minor version matching behavior (e.g.,
releases/26.3) - Add graceful fallback to overall latest release for invalid version formats
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Actions/Github-Helper.psm1 | Modified GetLatestRelease function to handle .x suffix removal and implement major-only version filtering with proper error handling and fallback behavior |
| Tests/GitHub-Helper.Test.ps1 | Added comprehensive test coverage for the new functionality including tests for major-only versions, major.minor versions, invalid formats, and edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
❔What, Why & How
CI/CD fails on branches like
releases/26.xwith error'26.x' cannot be recognized as a semantic version stringbecauseGetLatestReleaseattempts to parse the branch suffix directly as semver.Changes:
vprefix from branch version before parsing.xorxsuffix (with or without dot) from branch version before parsingreleases/26,releases/26.x,releases/26x,releases/v26,releases/v26.x,releases/v26x), match releases by major version onlyreleases/26.3), continue matching by major.minor as beforev26.3.0) in version matchingScenarios/settings.mdBefore:
releases/26.x→ tries to parse26.x→ throws exceptionAfter:
releases/26.x→ strips to26→ finds latest26.*.*release (excluding prereleases and drafts)Supported branch naming formats:
releases/26- major version onlyreleases/26.x- major version with.xsuffixreleases/26x- major version withxsuffix (no dot)releases/v26- major version withvprefixreleases/v26.x- major version withvprefix and.xsuffixreleases/v26x- major version withvprefix andxsuffixreleases/26.3- major.minor version✅ Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.