From 0cd637fb206b3bf0092dc27305af5c9b8f6243b7 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jun 2025 16:11:35 +0100 Subject: [PATCH] Update .forgejo/workflows/release.yml --- .forgejo/workflows/release.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 0fa45d8..1295213 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -121,19 +121,26 @@ jobs: "$FORGEJO_API/repos/$OWNER/$REPO/releases" | jq -r '.[0].created_at') echo "Fetching closed issues since $LAST_TAG_DATE..." - ISSUES=$(curl -s -H "Authorization: token $TOKEN" \ - "$FORGEJO_API/repos/$OWNER/$REPO/issues?state=closed&limit=100" | \ - jq -r --arg last_date "$LAST_TAG_DATE" ' - .[] | select(.closed_at > $last_date) | - "- [#\(.number)](\(.html_url)) \(.title)"') - - if [ -z "$ISSUES" ]; then - NOTES="## Release $VERSION\n\nNo issues closed since last release." + # Get closed issues since last tag (if any) + if [[ "$LATEST_TAG" != "null" && "$LATEST_TAG" != "v$VERSION" ]]; then + CLOSED_ISSUES=$(curl -s -H "Authorization: token $TOKEN" \ + "$FORGEJO_API/repos/$REPO_OWNER/$REPO_NAME/issues?state=closed&since=$(date -u -d "$(git log -1 --format=%cI $LATEST_TAG)" +"%Y-%m-%dT%H:%M:%SZ")" \ + | jq -r '.[] | "- [#\(.number)](\(.html_url)) \(.title)"') else - NOTES="## Release $VERSION\n\n### Closed Issues\n\n$ISSUES" + CLOSED_ISSUES="" fi - - echo "$NOTES" > release-notes.md + + # Build release notes with proper line breaks + { + echo "## Release v$VERSION" + echo + if [[ -n "$CLOSED_ISSUES" ]]; then + echo "### Closed Issues" + echo "$CLOSED_ISSUES" + else + echo "No issues closed since last release." + fi + } > release-notes.md cat release-notes.md # Create the release