@@ -223,33 +223,46 @@ jobs:
223223 - name : Generate release notes
224224 id : release_notes
225225 run : |
226- # Get the previous tag
227- PREV_TAG=$(git describe --tags --abbrev=0 ${{ needs.validate-tag.outputs.tag }}^)
226+ # Try to get the previous tag, handle case where this is the first tag
227+ PREV_TAG=$(git describe --tags --abbrev=0 ${{ needs.validate-tag.outputs.tag }}^ 2>/dev/null || echo "" )
228228
229229 echo "Generating release notes for ${{ needs.validate-tag.outputs.tag }}"
230- echo "Previous tag: $PREV_TAG"
231- echo ""
232230
233231 # Generate changelog
234232 echo "## Changes" > release_notes.md
235233 echo "" >> release_notes.md
236234
237- # Get all commits between previous tag and current tag, excluding version bump commits
238- git log --pretty=format:"- %s (%h)" $PREV_TAG..${{ needs.validate-tag.outputs.tag }} \
239- --grep="bump version" --grep="version bump" --grep="update version" \
240- --invert-grep >> release_notes.md
235+ if [ -n "$PREV_TAG" ]; then
236+ echo "Previous tag: $PREV_TAG"
237+ # Get all commits between previous tag and current tag, excluding version bump commits
238+ git log --pretty=format:"- %s (%h)" $PREV_TAG..${{ needs.validate-tag.outputs.tag }} \
239+ --grep="bump version" --grep="version bump" --grep="update version" \
240+ --invert-grep >> release_notes.md
241+
242+ # Add full changelog link
243+ echo "" >> release_notes.md
244+ echo "" >> release_notes.md
245+ echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREV_TAG...${{ needs.validate-tag.outputs.tag }}" >> release_notes.md
246+ else
247+ echo "This is the first release"
248+ # Get all commits up to this tag, excluding version bump commits
249+ git log --pretty=format:"- %s (%h)" ${{ needs.validate-tag.outputs.tag }} \
250+ --grep="bump version" --grep="version bump" --grep="update version" \
251+ --invert-grep >> release_notes.md
252+
253+ # Add repository link
254+ echo "" >> release_notes.md
255+ echo "" >> release_notes.md
256+ echo "**Repository**: https://github.com/${{ github.repository }}" >> release_notes.md
257+ fi
241258
242259 # Check if we have any commits
243260 if [ ! -s release_notes.md ] || [ $(wc -l < release_notes.md) -le 2 ]; then
244261 echo "## Changes" > release_notes.md
245262 echo "" >> release_notes.md
246- echo "- No significant changes since previous release " >> release_notes.md
263+ echo "- Initial release of funannotate2 " >> release_notes.md
247264 fi
248265
249- echo "" >> release_notes.md
250- echo "" >> release_notes.md
251- echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREV_TAG...${{ needs.validate-tag.outputs.tag }}" >> release_notes.md
252-
253266 echo "Generated release notes:"
254267 cat release_notes.md
255268
0 commit comments