Skip to content

Commit c9c3628

Browse files
committed
Fix changelog compare URL when no release exists for current Minecraft version
1 parent 8857ec0 commit c9c3628

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

build.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,16 @@ def getChangelog() {
7070
if (System.getenv().RELEASE) {
7171
return file("./CHANGELOG-${project.minecraft_version}.md").getText();
7272
} else {
73-
return "Changes since last release: ${project.github_url}/compare/${project.minecraft_version}-${project.mod_version}...${System.getenv().GITHUB_SHA}"
73+
// Check if any release tag exists for this Minecraft version
74+
def proc = ['git', 'tag', '--list', "${project.minecraft_version}-*"].execute([], project.rootProject.projectDir)
75+
def tags = proc.text.trim()
76+
if (tags) {
77+
return "Changes since last release: ${project.github_url}/compare/${project.minecraft_version}-${project.mod_version}...${System.getenv().GITHUB_SHA}"
78+
} else {
79+
// No release has been made yet for this Minecraft version, link to all commits on the branch
80+
def branch = System.getenv().GITHUB_REF_NAME ?: 'HEAD'
81+
return "Changes since last release: ${project.github_url}/commits/${branch}"
82+
}
7483
}
7584
}
7685
//ext {

0 commit comments

Comments
 (0)