chore: Fix commit window for release notes script#149
Merged
Conversation
scripts/preview-release-notes.sh
Outdated
| echo "ℹ️ Version v${CURRENT_VERSION} is already tagged." | ||
| echo " Showing what changed since the previous release." | ||
| # Get the second most recent tag (the one before current) | ||
| PREV_TAG=$(git tag -l 'v*' --sort=-version:refname | sed -n '2p') |
Contributor
There was a problem hiding this comment.
Preview script uses wrong previous tag for older versions
Medium Severity
When CURRENT_VERSION from package.json is already tagged but is not the most recent version tag, the script selects the wrong previous tag. The code uses sed -n '2p' to get the second tag in the version-sorted list, rather than the tag immediately preceding CURRENT_VERSION. For example, if tags v3.0.0, v2.0.0, v1.0.0 exist and CURRENT_VERSION is 1.0.0, the script would use v2.0.0 as PREV_TAG instead of the tag before v1.0.0, generating an incorrect changelog.
- Update README install links to match docs tabs (Wagmi first) - Fix preview script to find correct previous tag for older versions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Improves release notes tag selection for reliability when commit ancestry doesn't match version order.
/.github/workflows/release.ymlto derivePREV_TAGfromgit tag -l 'v*' --sort=-version:refname, excluding the current tagscripts/preview-release-notes.shto use version-sorted tags and handle cases where the current version is already tagged by selecting the next-most-recent tagWritten by Cursor Bugbot for commit f0498bd. This will update automatically on new commits. Configure here.
Greptile Summary
Replaced
git describewith version-sorted tag listing for more reliable release notes generation. The new approach handles cases where tags aren't direct ancestors in the commit tree, preventing incorrect commit ranges.Key changes:
release.yml: Usegit tag -l 'v*' --sort=-version:refnameto find previous tag, excluding current tagpreview-release-notes.sh: Handle case where current version is already tagged by selecting second-most-recent tag, plus fallback for when no new commits existREADME.md: Update installation instructions to recommend Wagmi integration and expand Next.js optionsThe fix ensures correct commit window calculation when generating changelogs.
Confidence Score: 5/5
Important Files Changed
git describeto version-sortedv*tags for more reliable release note generationSequence Diagram
sequenceDiagram participant GH as GitHub Actions participant Git as Git Repository participant Script as release.yml/preview script Note over GH,Script: Tag Selection Process GH->>Script: Trigger release workflow (tag: v1.26.0) Script->>Git: git tag -l 'v*' --sort=-version:refname Git-->>Script: v1.26.0, v1.23.0, v1.22.0... Script->>Script: Filter out current tag (v1.26.0) Script->>Script: Select first tag (v1.23.0) Note over Script: Previous approach would use:<br/>git describe --tags --abbrev=0 HEAD^<br/>which follows commit ancestry Script->>Git: git log v1.23.0..HEAD Git-->>Script: Commits between tags Script->>Script: Categorize commits (feat/fix/other) Script->>Script: Format release notes with PR links Script->>GH: Return formatted changelog