Skip to content

Commit

Permalink
Handle release track names containing a colon (#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
chimbori and [email protected] authored Jun 28, 2024
1 parent fe56095 commit 75c58a5
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ internal abstract class PublishArtifactWorkerBase<T : PublishArtifactWorkerBase.
return if (config.releaseName != null) {
config.releaseName
} else if (parameters.consoleNamesDir.isPresent) {
val dir = parameters.consoleNamesDir.get().asFile
val file = File(dir, "$track.txt").orNull()
?: File(dir, RELEASE_NAMES_DEFAULT_NAME).orNull()

val dir = parameters.consoleNamesDir.get()
val file = dir.file("${track.replace(':', '-')}.txt").asFile.orNull()
?: dir.file("${track.substringAfter(':')}.txt").asFile.orNull()
?: dir.file(RELEASE_NAMES_DEFAULT_NAME).asFile.orNull()
file?.readProcessed()?.lines()?.firstOrNull()
} else {
null
Expand All @@ -35,9 +35,9 @@ internal abstract class PublishArtifactWorkerBase<T : PublishArtifactWorkerBase.
protected fun findReleaseNotes(track: String): Map<String, String?> {
val locales = parameters.releaseNotesDir.orNull?.asFile?.listFiles().orEmpty()
return locales.mapNotNull { locale ->
var result = File(locale, "$track.txt").orNull()
if (result == null) result = File(locale, RELEASE_NOTES_DEFAULT_NAME).orNull()
result
File(locale, "${track.replace(':', '-')}.txt").orNull()
?: File(locale, "${track.substringAfter(':')}.txt").orNull()
?: File(locale, RELEASE_NOTES_DEFAULT_NAME).orNull()
}.associate { notes ->
notes.parentFile.name to notes.readProcessed()
}.toSortedMap()
Expand Down

0 comments on commit 75c58a5

Please sign in to comment.