@@ -72,19 +72,37 @@ jobs:
7272 # Fetch milestone ID for the link
7373 MILESTONE_ID=$(gh api repos/${{ github.repository }}/milestones -q ".[] | select(.title==\"$VERSION_NUM\") | .number")
7474
75- # Fetch closed issues and PRs for this milestone, excluding the dependencies label
75+ # 1. Fetch NEW features (requires the 'feature' label)
7676 gh issue list \
7777 --repo ${{ github.repository }} \
78- --search "milestone:\"$VERSION_NUM\" is:closed - label:dependencies " \
78+ --search "milestone:\"$VERSION_NUM\" label:feature " \
7979 --limit 100 \
8080 --json title,url \
81- --jq '.[] | "- [\(.title)](\(.url))"' > milestone_issues .md
81+ --jq '.[] | "- [\(.title)](\(.url))"' > new_issues .md
8282
83- # Assemble the final changelog.md
84- cat << EOF > changelog.md
85- $(cat milestone_issues.md)
83+ # 2. Fetch OTHER changes (excludes 'feature' and 'dependencies')
84+ gh issue list \
85+ --repo ${{ github.repository }} \
86+ --search "milestone:\"$VERSION_NUM\" -label:feature -label:dependencies" \
87+ --limit 100 \
88+ --json title,url \
89+ --jq '.[] | "- [\(.title)](\(.url))"' > other_issues.md
8690
91+ # 3. Initialize the changelog file
92+ > changelog.md
93+
94+ # 4. Conditionally add "What is new?" only if new_issues.md has content (-s)
95+ if [ -s new_issues.md ]; then
96+ echo "## What is new?" >> changelog.md
97+ cat new_issues.md >> changelog.md
98+ echo "" >> changelog.md
99+ fi
100+
101+ # 5. Build the rest of the changelog ("Changes" is always present)
102+ cat << EOF >> changelog.md
87103 ## Changes
104+ $(cat other_issues.md)
105+
88106 - [$CURRENT_TAG](https://github.com/jooby-project/jooby/tree/$CURRENT_TAG)
89107 - [Issues](https://github.com/jooby-project/jooby/milestone/$MILESTONE_ID?closed=1)
90108 - [Changelog](https://github.com/jooby-project/jooby/compare/$PREV_TAG...$CURRENT_TAG)
0 commit comments