Skip to content

Commit

Permalink
[ci skip] chore: change how release messages work
Browse files Browse the repository at this point in the history
  • Loading branch information
Syrent committed Jun 27, 2024
1 parent c38d57c commit 0757245
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,11 @@ fun lastReleaseCommitMessages(): String {
connection.requestMethod = "GET"
connection.setRequestProperty("Accept", "application/vnd.github.v3+json")
val response = connection.inputStream.bufferedReader().use { it.readText() }
val targetCommitish = JsonParser.parseString(response).asJsonArray.get(0).asJsonObject.get("target_commitish").asString

val sha = if (targetCommitish.matches(Regex("^[a-f0-9]{40}$"))) {
targetCommitish
} else {
val branchUrl = URL("https://api.github.com/repos/Syrent/$name/git/refs/heads/$targetCommitish")
val branchConnection = branchUrl.openConnection() as HttpURLConnection
branchConnection.requestMethod = "GET"
branchConnection.setRequestProperty("Accept", "application/vnd.github.v3+json")
val branchResponse = branchConnection.inputStream.bufferedReader().use { it.readText() }
JsonParser.parseString(branchResponse).asJsonObject.get("object").asJsonObject.get("sha").asString
}
val previousReleaseVersion = JsonParser.parseString(response).asJsonArray.get(1).asJsonObject.get("tag_name").asString

return executeGitCommand("log", "--pretty=format:%s%n", "$sha..HEAD")
val currentProjectVersion = version.toString()

return executeGitCommand("log", "--pretty=format:%s%n", "$previousReleaseVersion..$currentProjectVersion")
}

val versionString: String = findProperty("version")!! as String
Expand Down

0 comments on commit 0757245

Please sign in to comment.