Skip to content

Comments

chore: Fix commit window for release notes script#149

Merged
yosriady merged 2 commits intomainfrom
chore/release-notes
Jan 15, 2026
Merged

chore: Fix commit window for release notes script#149
yosriady merged 2 commits intomainfrom
chore/release-notes

Conversation

@yosriady
Copy link
Contributor

@yosriady yosriady commented Jan 15, 2026

Note

Improves release notes tag selection for reliability when commit ancestry doesn't match version order.

  • Updates /.github/workflows/release.yml to derive PREV_TAG from git tag -l 'v*' --sort=-version:refname, excluding the current tag
  • Enhances scripts/preview-release-notes.sh to use version-sorted tags and handle cases where the current version is already tagged by selecting the next-most-recent tag
  • Minor README installation list updates (add Wagmi/HTML snippet, clarify Next.js variants)

Written by Cursor Bugbot for commit f0498bd. This will update automatically on new commits. Configure here.

Greptile Summary

Replaced git describe with 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:

  • In release.yml: Use git tag -l 'v*' --sort=-version:refname to find previous tag, excluding current tag
  • In preview-release-notes.sh: Handle case where current version is already tagged by selecting second-most-recent tag, plus fallback for when no new commits exist
  • In README.md: Update installation instructions to recommend Wagmi integration and expand Next.js options

The fix ensures correct commit window calculation when generating changelogs.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Changes are well-scoped improvements to build tooling with clear benefits. The tag selection logic is more robust than the previous approach, and the preview script handles edge cases appropriately. Documentation updates are straightforward.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/release.yml Improved previous tag selection from git describe to version-sorted v* tags for more reliable release note generation
scripts/preview-release-notes.sh Enhanced tag selection logic to handle already-tagged versions and added fallback when no new commits exist
README.md Updated installation docs to highlight Wagmi as recommended method and expanded Next.js installation options

Sequence 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
Loading

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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

- 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>
@yosriady yosriady merged commit 0624236 into main Jan 15, 2026
13 checks passed
@yosriady yosriady deleted the chore/release-notes branch January 15, 2026 11:04
@greptile-apps greptile-apps bot mentioned this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant