Skip to content

Commit

Permalink
Merge pull request #39 from gsmet/fix-small-things
Browse files Browse the repository at this point in the history
Fix small things
  • Loading branch information
gsmet authored Jan 3, 2024
2 parents 5f2bcb4 + d503751 commit 50ba299
Showing 1 changed file with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void injectBuildScans(Context context, Commands commands, Inputs inputs, GitHub
}

Map<String, String> buildScanMapping = statuses.builds.stream()
.filter(s -> s.jobName != null)
.collect(Collectors.toMap(s -> s.jobName, s -> s.buildScanLink));

try {
Expand Down Expand Up @@ -200,7 +201,7 @@ private Optional<GHCheckRun> 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");
}

Expand All @@ -218,24 +219,16 @@ private Optional<GHCheckRun> 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 {
Expand All @@ -249,7 +242,7 @@ public static class BuildScanStatus implements Comparable<BuildScanStatus> {

public String jobName;

public String status;
public Boolean buildFailure;

public String buildScanLink;

Expand Down

0 comments on commit 50ba299

Please sign in to comment.