diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-13 21:37:11 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-13 21:37:11 +0100 |
commit | 7ff66cf61c05b6f171300da96a4afe9ce3747f35 (patch) | |
tree | e38eb153d7898d26408100a7322426685757a585 | |
parent | bdd92b4f440063f582a242670afd38d61b76f6d1 (diff) | |
download | SkyHanniChangelogBuilder-7ff66cf61c05b6f171300da96a4afe9ce3747f35.tar.gz SkyHanniChangelogBuilder-7ff66cf61c05b6f171300da96a4afe9ce3747f35.tar.bz2 SkyHanniChangelogBuilder-7ff66cf61c05b6f171300da96a4afe9ce3747f35.zip |
better error logic
-rw-r--r-- | src/main/kotlin/Main.kt | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index e4aadb7..494ba10 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -75,7 +75,7 @@ fun readPrs( beta: Int, ) { val allChanges = mutableListOf<Change>() - var errors = 0 + val errors = mutableListOf<String>() var excluded = 0 var done = 0 var wrongPrName = 0 @@ -117,10 +117,10 @@ fun readPrs( allChanges.addAll(newChanges) done++ } catch (t: Throwable) { - println("") - println("Error in #$number ($prLink)") - println(t.message) - errors++ + errors.add("Error in #$number ($prLink)\n${t.message}") + if (hasWrongPrName(prLink, title, emptyList())) { + wrongPrName++ + } } if (whatToDo == WhatToDo.NEXT_BETA) { if (number == firstPr) break @@ -128,6 +128,11 @@ fun readPrs( } println("") + for (error in errors) { + println(" ") + println(error) + } + for (type in OutputType.entries) { print(allChanges, type, fullVersion, beta) } @@ -135,14 +140,15 @@ fun readPrs( if (excluded > 0) { println("Excluded $excluded PRs.") } - if (errors > 0) { - println("Found $errors PRs with errors!") + val errorSize = errors.size + if (errorSize > 0) { + println("Found $errorSize PRs with errors!") } if (wrongPrName > 0) { println("Found $wrongPrName PRs with wrong names!") } println("Loaded $done PRs correctly.") - if (errors > 0) { + if (errorSize > 0) { if (hideWhenError) { exitProcess(-1) } @@ -170,6 +176,16 @@ fun hasWrongPrName(prLink: String, title: String, newChanges: List<Change>): Boo } } + val prefix = "Wrong/broken Changelog: " + if (!title.startsWith(prefix)) { + println("wrong pr title!") + println("found: '$title'") + println("should start with $prefix") + println("link: $prLink") + println(" ") + return true + } + return false } |