@@ -91,16 +91,27 @@ jobs:
9191 VERSION="${TAG_NAME#v}"
9292
9393 if [ ! -f "CHANGELOG.md" ]; then
94- echo "section=See release notes for details ." >> $GITHUB_OUTPUT
94+ echo "section=No changelog available for this release ." >> $GITHUB_OUTPUT
9595 exit 0
9696 fi
9797
9898 # Extract content between this version header and the next version header
99+ # Handle both [version] and version formats in headers
99100 SECTION=$(awk "/^## \[?${VERSION}\]?/{found=1; next} /^## \[?[0-9]+\.[0-9]+\.[0-9]+\]?/{if(found) exit} found{print}" CHANGELOG.md)
100101
101- # If extraction failed, use a default message
102+ # Trim leading/trailing whitespace
103+ SECTION=$(echo "$SECTION" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
104+
105+ # If extraction failed or empty, try alternative patterns
106+ if [ -z "$SECTION" ]; then
107+ # Try with just the version number in various formats
108+ SECTION=$(awk "/^##.*${VERSION}/{found=1; next} /^## /{if(found) exit} found{print}" CHANGELOG.md)
109+ SECTION=$(echo "$SECTION" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
110+ fi
111+
112+ # If still empty, provide a meaningful fallback
102113 if [ -z "$SECTION" ]; then
103- SECTION="See [CHANGELOG.md](CHANGELOG.md) for details ."
114+ SECTION="No detailed changelog available for version ${VERSION} ."
104115 fi
105116
106117 # Write to output (handle multiline)
@@ -145,10 +156,10 @@ jobs:
145156 body : |
146157 ## What's Changed
147158
148- ${{ needs.generate-changelog.outputs.changelog-section || 'See [CHANGELOG.md](CHANGELOG.md) for details .' }}
159+ ${{ needs.generate-changelog.outputs.changelog-section || 'No detailed changelog available for this release .' }}
149160
150161 ---
151- ** Full Changelog**: See [ CHANGELOG.md](CHANGELOG.md)
162+ 📄 **[View Full Changelog](https://github.com/${{ github.repository }}/blob/main/ CHANGELOG.md)**
152163
153164 # Step 3: Build and publish to PyPI
154165 publish-pypi :
0 commit comments