@@ -170,56 +170,64 @@ jobs:
170170 - name : Generate Release Notes
171171 id : release_notes
172172 run : |
173+ set -e # Exit on error
174+
173175 VERSION="${{ github.event.inputs.version }}"
174176 PREVIOUS_TAG=$(git describe --tags --abbrev=0 --exclude="v$VERSION" 2>/dev/null || echo "")
175177
176- echo "Generating release notes for v$VERSION..."
177- echo "Previous tag: $PREVIOUS_TAG"
178+ # Send debug output to stderr to avoid polluting release notes
179+ echo "Generating release notes for v$VERSION..." >&2
180+ echo "Previous tag: $PREVIOUS_TAG" >&2
178181
179182 # Get merged PRs since last tag
180183 if [ -n "$PREVIOUS_TAG" ]; then
181184 PREVIOUS_DATE=$(git log -1 --format=%aI "$PREVIOUS_TAG" 2>/dev/null)
182- PRS=$(gh pr list --state merged --search "merged:>$PREVIOUS_DATE" --json number,title,author --jq '.[] | "- #\(.number) \(.title) (@\(.author.login))"')
185+ echo "Getting PRs merged after $PREVIOUS_DATE..." >&2
186+ # Limit to 50 PRs and suppress any extra output
187+ PRS=$(gh pr list --state merged --search "merged:>$PREVIOUS_DATE" --limit 50 --json number,title,author --jq '.[] | "- #\(.number) \(.title) (@\(.author.login))"' 2>&1 | grep "^-" || echo "")
183188 else
184- PRS=$(gh pr list --state merged --json number,title,author --jq '.[] | "- #\(.number) \(.title) (@\(.author.login))"')
189+ echo "No previous tag found, getting all merged PRs..." >&2
190+ # Limit to 50 PRs and suppress any extra output
191+ PRS=$(gh pr list --state merged --limit 50 --json number,title,author --jq '.[] | "- #\(.number) \(.title) (@\(.author.login))"' 2>&1 | grep "^-" || echo "")
185192 fi
186193
187- # Create release notes
188- cat > release_notes.md << EOF
189- ## What's Changed
190-
191- EOF
192-
193- if [ -n "$PRS" ]; then
194- echo "$PRS" >> release_notes.md
195- else
196- echo "- No merged PRs found" >> release_notes.md
197- fi
198-
199- cat >> release_notes.md << EOF
200-
201- ## Installation
202-
203- ```bash
204- npm install react-native-nitro-device-info@$VERSION
205- # or
206- yarn add react-native-nitro-device-info@$VERSION
207- ```
208-
209- ## Documentation
210-
211- - [README](https://github.com/l2hyunwoo/react-native-nitro-device-info#readme)
212-
213- **Full Changelog**: https://github.com/l2hyunwoo/react-native-nitro-device-info/compare/$PREVIOUS_TAG...v$VERSION
214- EOF
215-
216- # Output the release notes
217- RELEASE_NOTES=$(cat release_notes.md)
218- echo "release_notes<<EOF" >> $GITHUB_OUTPUT
219- echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
220- echo "EOF" >> $GITHUB_OUTPUT
221-
222- echo "✓ Release notes generated"
194+ # Create release notes in a clean way
195+ {
196+ echo "## What's Changed"
197+ echo ""
198+ if [ -n "$PRS" ]; then
199+ echo "$PRS"
200+ else
201+ echo "- No merged PRs found"
202+ fi
203+ echo ""
204+ echo "## Installation"
205+ echo ""
206+ echo '```bash'
207+ echo "npm install react-native-nitro-device-info@$VERSION"
208+ echo "# or"
209+ echo "yarn add react-native-nitro-device-info@$VERSION"
210+ echo '```'
211+ echo ""
212+ echo "## Documentation"
213+ echo ""
214+ echo "- [README](https://github.com/l2hyunwoo/react-native-nitro-device-info#readme)"
215+ echo ""
216+ if [ -n "$PREVIOUS_TAG" ]; then
217+ echo "**Full Changelog**: https://github.com/l2hyunwoo/react-native-nitro-device-info/compare/$PREVIOUS_TAG...v$VERSION"
218+ else
219+ echo "**Full Changelog**: https://github.com/l2hyunwoo/react-native-nitro-device-info/commits/v$VERSION"
220+ fi
221+ } > release_notes.md
222+
223+ # Output the release notes to GitHub output
224+ {
225+ echo "release_notes<<RELEASE_NOTES_EOF"
226+ cat release_notes.md
227+ echo "RELEASE_NOTES_EOF"
228+ } >> $GITHUB_OUTPUT
229+
230+ echo "✓ Release notes generated" >&2
223231 env :
224232 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
225233
0 commit comments