Skip to content

Commit

Permalink
Improve changelog generation
Browse files Browse the repository at this point in the history
Picks relevant commits
Skips merge commits
  • Loading branch information
NotMyWing authored and Exaxxion committed Sep 4, 2020
1 parent cc43155 commit ba377e0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,19 @@ task generateChangelog {
, "--date=format:%d %b %Y"
, "--pretty=%s - **%an** (%ad)"
, "${lastTag}..HEAD"
]))
].plus(
/*
Collect relevant directories only, them being:
* ./src/main/java
* ./src/main/resources
*/
sourceSets.main.java.srcDirs
.plus(sourceSets.main.resources.srcDirs)
.collect { [ "--", it ] }
).flatten()))

if (changelog) {
changelog = "Changes since ${lastTag}:\n${("\n" + changelog).replaceAll("\n", "\n ")}"
changelog = "Changes since ${lastTag}:\n${("\n" + changelog).replaceAll("\n", "\n* ")}"
}

def f = new File("build/tmp/changelog.md")
Expand Down Expand Up @@ -224,6 +233,7 @@ task deployCurseForge {
def log = new File("build/tmp/changelog.md")
.getText("UTF-8")
.replaceAll("\n", " \n")
.replaceAll("\n\\*", "\n")

def root = it {
changelog log
Expand Down

0 comments on commit ba377e0

Please sign in to comment.