Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Commit d4c2450

Browse files
committed
Use commit message as changelog like in VV/VB/VAF
Signed-off-by: Florian Reuth <git@florianreuth.de>
1 parent 811caf2 commit d4c2450

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

build.gradle

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
import me.modmuss50.mpp.ReleaseType
22

3+
String runGitCommand(Project project, List<String> args) {
4+
try {
5+
def output = new ByteArrayOutputStream()
6+
project.exec {
7+
commandLine(["git"] + args)
8+
standardOutput = output
9+
ignoreExitValue = true
10+
}
11+
12+
def result = output.toString("UTF-8").trim()
13+
return result ? result : "unknown"
14+
} catch (Exception ignored) {
15+
return "unknown"
16+
}
17+
}
18+
19+
String latestCommitHash(Project project) {
20+
return runGitCommand(project, ["rev-parse", "--short", "HEAD"])
21+
}
22+
23+
String latestCommitMessage(Project project) {
24+
return runGitCommand(project, ["log", "-1", "--pretty=%B"])
25+
}
26+
327
buildscript {
428
// Unify build logic of all submodules in here, ugly but easier since we have to deal with a lot random stuff
529
repositories {
@@ -262,7 +286,13 @@ subprojects {
262286
} else {
263287
file = tasks.shadowJar.archiveFile
264288
}
265-
changelog = "A changelog can be found at https://github.com/ViaVersion/ViaForge/commits"
289+
def commitHash = latestCommitHash(rootProject)
290+
def commitMessage = latestCommitMessage(rootProject).replaceAll("\\s+", " ").trim()
291+
if (commitHash == "unknown" || commitMessage == "unknown") {
292+
changelog = "A changelog can be found at https://github.com/ViaVersion/ViaForge/commits"
293+
} else {
294+
changelog = "[${commitHash}](https://github.com/ViaVersion/ViaForge/commit/${commitHash}) ${commitMessage}"
295+
}
266296
version = project.version.toString() + "+" + mcVersion
267297
displayName = version
268298
modLoaders.add("forge")

0 commit comments

Comments
 (0)