Closes #1524
This commit is contained in:
parent
f862a4be97
commit
75f319e4c5
|
@ -2,6 +2,9 @@ package publish
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
|
|
||||||
|
private const val RELEASE_NOTES_MAX_LENGTH = 500
|
||||||
|
private const val NEW_LINE_SIGN = "\n"
|
||||||
|
|
||||||
data class ChangelogEntry(
|
data class ChangelogEntry(
|
||||||
val version: String,
|
val version: String,
|
||||||
val date: String,
|
val date: String,
|
||||||
|
@ -27,9 +30,17 @@ data class ChangelogEntry(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun StringBuilder.appendChangeLogSection(section: ChangelogEntrySection) {
|
private fun StringBuilder.appendChangeLogSection(section: ChangelogEntrySection) {
|
||||||
appendLine(section.title)
|
appendLineIfCan(section.title)
|
||||||
appendLine(section.content)
|
appendLineIfCan(section.content)
|
||||||
appendLine()
|
}
|
||||||
|
|
||||||
|
private fun StringBuilder.appendLineIfCan(line: String) {
|
||||||
|
if (length + line.length <= RELEASE_NOTES_MAX_LENGTH) {
|
||||||
|
append(line)
|
||||||
|
}
|
||||||
|
if (length + NEW_LINE_SIGN.length <= RELEASE_NOTES_MAX_LENGTH) {
|
||||||
|
append(NEW_LINE_SIGN)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toJsonString(): String =
|
fun toJsonString(): String =
|
||||||
|
|
Loading…
Reference in New Issue