Skip to content

Commit ba377e0

Browse files
NotMyWingExaxxion
authored andcommitted
Improve changelog generation
Picks relevant commits Skips merge commits
1 parent cc43155 commit ba377e0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

build.gradle

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,19 @@ task generateChangelog {
145145
, "--date=format:%d %b %Y"
146146
, "--pretty=%s - **%an** (%ad)"
147147
, "${lastTag}..HEAD"
148-
]))
148+
].plus(
149+
/*
150+
Collect relevant directories only, them being:
151+
* ./src/main/java
152+
* ./src/main/resources
153+
*/
154+
sourceSets.main.java.srcDirs
155+
.plus(sourceSets.main.resources.srcDirs)
156+
.collect { [ "--", it ] }
157+
).flatten()))
149158

150159
if (changelog) {
151-
changelog = "Changes since ${lastTag}:\n${("\n" + changelog).replaceAll("\n", "\n ")}"
160+
changelog = "Changes since ${lastTag}:\n${("\n" + changelog).replaceAll("\n", "\n* ")}"
152161
}
153162

154163
def f = new File("build/tmp/changelog.md")
@@ -224,6 +233,7 @@ task deployCurseForge {
224233
def log = new File("build/tmp/changelog.md")
225234
.getText("UTF-8")
226235
.replaceAll("\n", " \n")
236+
.replaceAll("\n\\*", "\n")
227237

228238
def root = it {
229239
changelog log

0 commit comments

Comments
 (0)