From ba377e0f33dfe9a9a646692f34756264d9ac371b Mon Sep 17 00:00:00 2001 From: Neeve01 Date: Tue, 28 Jul 2020 16:41:01 +0300 Subject: [PATCH] Improve changelog generation Picks relevant commits Skips merge commits --- build.gradle | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index bc27987..8c0236b 100644 --- a/build.gradle +++ b/build.gradle @@ -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") @@ -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