Skip to content

Commit 1b8dde7

Browse files
authored
Changelog script. Add protection to check that it was cloned successfully (#5428)
I had a situation when the folder was empty, and the git log collected commits from the parent repo compose-multiplatform instead of compose-multiplatform-core ## Release Notes N/A
1 parent 9b678ab commit 1b8dde7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/changelog/changelog.main.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,14 +519,17 @@ fun githubClone(repo: String): File {
519519
val url = "https://github.com/$repo"
520520
val folder = File("build/github/$repo")
521521
val absolutePath = folder.absolutePath
522-
if (!folder.exists()) {
522+
if (!folder.exists() || folder.listFiles()?.isEmpty() == true) {
523523
folder.mkdirs()
524524
println("Cloning $url into ${folder.absolutePath}")
525525
pipeProcess("git clone --bare $url $absolutePath").waitAndCheck()
526526
} else {
527527
println("Fetching $url into ${folder.absolutePath}")
528528
pipeProcess("git -C $absolutePath fetch --force --tags").waitAndCheck()
529529
}
530+
check(folder.listFiles()?.isNotEmpty() == true) {
531+
"Cloning $url failed"
532+
}
530533
return folder
531534
}
532535

0 commit comments

Comments
 (0)