-
Notifications
You must be signed in to change notification settings - Fork 0
fix: release tag sorting #909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe pull request modifies the release utility script to adjust prerelease version numbering and improve tag retrieval logic. The Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
scripts/releaseUtils.ts (2)
148-162: Confirm intent around new-alpha.1/-beta.1/-rc.1behaviorThe new
alpha/beta/rcbranches now start the next patch prerelease at.1(e.g.1.2.3-alpha.2→1.2.4-alpha.1), which matches the PR description for continuing from an existing prerelease. However, therc-minor/beta-minor/alpha-minorand corresponding*-majoroptions still usesemver.inc(..., "pre*"), which will continue to produce*.0as the initial prerelease when starting from a stable version.If your goal is for all new alpha/beta/rc trains (including the
preminor/premajorflows) to start at.1, you may also want to adjust those branches (e.g., by post‑processing the*.0result or doing a secondprereleasebump).
185-192: HardengetLatestTagfor empty output and typesUsing
git tag --sort=-v:refnameis a solid way to get semver‑ordered tags, but there are a couple of small robustness points here:
- If the repo has no tags,
result.stdout.trim().split(/\n/).filter(Boolean)[0]yieldsundefinedeven though the function is typed asPromise<string>.- On Windows, splitting only on
\nmay leave a trailing\ron lines.You can make this safer and keep the
Promise<string>signature by normalizing the value and handling CRLF:export async function getLatestTag(): Promise<string> { - // -v:refname is a descending semver sort - const result = await run("git", ["tag", "--sort=-v:refname"], { - stdio: "pipe", - }); - - return result.stdout.trim().split(/\n/).filter(Boolean)[0]; + // -v:refname is a descending semver sort + const result = await run("git", ["tag", "--sort=-v:refname"], { + stdio: "pipe", + }); + + const latest = + result.stdout + .trim() + .split(/\r?\n/) + .find(Boolean) ?? ""; + + return latest; }
logRecentCommitswill still treat an empty string as “no tag”.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
scripts/releaseUtils.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: call_unit_test / unit_tests (18.x)
- GitHub Check: call_unit_test / unit_tests (20.x)
- GitHub Check: semgrep/ci
@anguyen-yext2 pointed out that our
getLatestTagfunction sorts alphabetically instead of by semverTested by running the function in node and returning the full list of versions. Confirmed that the old code output
'v1.0.0-beta.0', 'v0.0.9', 'v0.0.8', 'v0.0.7',while the new code output'v1.0.0-beta.0', 'v0.0.66', 'v0.0.65', 'v0.0.64',....Also updates the initial version for alpha/beta/rc releases to be
.1