Browse Source

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
pull/5430/head
Igor Demin 3 months ago committed by GitHub
parent
commit
1b8dde746e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      tools/changelog/changelog.main.kts

5
tools/changelog/changelog.main.kts

@ -519,7 +519,7 @@ fun githubClone(repo: String): File { @@ -519,7 +519,7 @@ fun githubClone(repo: String): File {
val url = "https://github.com/$repo"
val folder = File("build/github/$repo")
val absolutePath = folder.absolutePath
if (!folder.exists()) {
if (!folder.exists() || folder.listFiles()?.isEmpty() == true) {
folder.mkdirs()
println("Cloning $url into ${folder.absolutePath}")
pipeProcess("git clone --bare $url $absolutePath").waitAndCheck()
@ -527,6 +527,9 @@ fun githubClone(repo: String): File { @@ -527,6 +527,9 @@ fun githubClone(repo: String): File {
println("Fetching $url into ${folder.absolutePath}")
pipeProcess("git -C $absolutePath fetch --force --tags").waitAndCheck()
}
check(folder.listFiles()?.isNotEmpty() == true) {
"Cloning $url failed"
}
return folder
}

Loading…
Cancel
Save