[Fix] Use stable base for stable release notes#496
Conversation
Signed-off-by: samzong <samzong.lu@gmail.com>
|
Hi @samzong, DetailsInstructions for interacting with me using comments are available here. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the accuracy of release note generation by refining how the base tag is resolved. By intelligently filtering out prerelease tags when generating notes for stable releases, the script now ensures that stable release notes correctly summarize changes since the last stable version rather than the most recent beta. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces logic to distinguish between stable and pre-release tags when generating release notes by adding isStableTag and previousTag helper functions. The argument parsing logic has been refactored to utilize these helpers for determining the base tag. A security improvement was suggested to prevent potential command injection by escaping the head parameter when executing shell commands.
|
|
||
| function previousTag(head) { | ||
| const prereleaseFilter = isStableTag(head) ? " --exclude 'v*-*'" : ''; | ||
| return sh(`git describe --tags --abbrev=0${prereleaseFilter} ${head}^`, { allowFail: true }); |
There was a problem hiding this comment.
The head parameter is interpolated directly into a shell command string, which is vulnerable to command injection if the input contains shell metacharacters (e.g., ;, &, |). Although this is a local script, it's safer to escape the argument. Since other parts of this script use JSON.stringify() for this purpose (e.g., line 196), it should be applied here as well.
| return sh(`git describe --tags --abbrev=0${prereleaseFilter} ${head}^`, { allowFail: true }); | |
| return sh(`git describe --tags --abbrev=0${prereleaseFilter} ${JSON.stringify(head + '^')}`, { allowFail: true }); |
Summary
Fix release note range resolution so stable tags use the previous stable tag as the base, while prerelease tags continue to use the previous tag.
Type of change
[Feat]new feature[Fix]bug fix[UI]UI or UX change[Docs]documentation-only change[Refactor]internal cleanup[Build]CI, packaging, or tooling change[Chore]maintenanceWhy is this needed?
Stable release notes for tags like
v0.0.15should summarize changes since the previous stable release, not only since the latest beta tag. Beta release notes should still use the previous prerelease tag.What changed?
vX.Y.Zrelease refs.Architecture impact
docs/architecture-invariants.md: noneLinked issues
N/A
Validation
pnpm lintpnpm testpnpm buildpnpm check:ui-contractCommands, screenshots, or notes:
Screenshots or recordings
N/A. This change affects release note script behavior only.
Release note
NONE.Checklist
git commit -s)[Feat],[Fix],[UI],[Docs],[Refactor],[Build], or[Chore]