diff --git a/src/main/java/io/quarkus/bot/develocity/InjectBuildScansAction.java b/src/main/java/io/quarkus/bot/develocity/InjectBuildScansAction.java index 414cc72..1185f4b 100644 --- a/src/main/java/io/quarkus/bot/develocity/InjectBuildScansAction.java +++ b/src/main/java/io/quarkus/bot/develocity/InjectBuildScansAction.java @@ -79,6 +79,7 @@ void injectBuildScans(Context context, Commands commands, Inputs inputs, GitHub } Map buildScanMapping = statuses.builds.stream() + .filter(s -> s.jobName != null) .collect(Collectors.toMap(s -> s.jobName, s -> s.buildScanLink)); try { @@ -200,7 +201,7 @@ private Optional createBuildScansOutput(Commands commands, GHWorkflo buildScans.append("| :-: | -- | :-: |\n"); for (BuildScanStatus build : statuses.builds) { - buildScans.append("| ").append(getConclusionEmoji(build.status)).append(" | ").append(build.jobName) + buildScans.append("| ").append(getConclusionEmoji(build.buildFailure)).append(" | ").append(build.jobName) .append(" | [:mag:](").append(build.buildScanLink).append(") |\n"); } @@ -218,24 +219,16 @@ private Optional createBuildScansOutput(Commands commands, GHWorkflo } } - private static String getConclusionEmoji(String conclusion) { - // apparently, conclusion can sometimes be null... - if (conclusion == null) { + private static String getConclusionEmoji(Boolean buildFailure) { + if (buildFailure == null) { return ":question:"; } - switch (conclusion) { - case "success": - return ":heavy_check_mark:"; - case "failure": - return "✖"; - case "cancelled": - return ":hourglass:"; - case "skipped": - return ":no_entry_sign:"; - default: - return ":question:"; + if (buildFailure) { + return "✖"; } + + return ":heavy_check_mark:"; } public static class BuildScanStatuses { @@ -249,7 +242,7 @@ public static class BuildScanStatus implements Comparable { public String jobName; - public String status; + public Boolean buildFailure; public String buildScanLink;