From 27ba48009d61aa6e37953d0f89e09e2a96787150 Mon Sep 17 00:00:00 2001 From: Declan Lynch Date: Fri, 7 Jul 2023 08:22:46 -0400 Subject: [PATCH] Fix to halt site generation if the default branch is not valid. --- .../nl/avisi/structurizr/site/generatr/GenerateSiteCommand.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/GenerateSiteCommand.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/GenerateSiteCommand.kt index a965fa8a..e58607be 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/GenerateSiteCommand.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/GenerateSiteCommand.kt @@ -104,6 +104,10 @@ class GenerateSiteCommand : Subcommand( println("The following branches contain a valid Structurizr workspace: $branchesToGenerate") + if (!branchesToGenerate.contains(defaultBranch)) { + throw Exception("$defaultBranch does not contain a valid structurizr workspace. Site generation halted.") + } + branchesToGenerate.forEach { branch -> println("Generating site for branch $branch") clonedRepository.checkoutBranch(branch)