Skip to content
Permalink
Browse files
1053: Github check in conclusion "stale" not handled
Reviewed-by: ehelin
  • Loading branch information
erikj79 committed May 27, 2021
1 parent ca8d1c3 commit 2eb3dabfb1cde7ae3d48d8168038135236a47e13
Showing 4 changed files with 13 additions and 2 deletions.
@@ -140,6 +140,8 @@ static String statusForCheck(Check check) {
return "FAILED";
} else if (checkStatus == CheckStatus.CANCELLED) {
return "CANCELLED";
} else if (checkStatus == CheckStatus.STALE) {
return "STALE";
}

return "UNKNOWN";
@@ -142,6 +142,12 @@ public CheckBuilder skipped(ZonedDateTime actionRequiredAt) {
return this;
}

public CheckBuilder stale() {
status = CheckStatus.STALE;
completedAt = ZonedDateTime.now();
return this;
}

public Check build() {
return new Check(name, hash, status, startedAt, completedAt, metadata, title, summary, annotations, details);
}
@@ -27,5 +27,6 @@ public enum CheckStatus {
SUCCESS,
FAILURE,
CANCELLED,
SKIPPED
SKIPPED,
STALE
}
@@ -407,12 +407,14 @@ public Map<String, Check> checks(Hash hash) {
var completed = c.get("status").asString().equals("completed");
if (completed) {
var conclusion = c.get("conclusion").asString();
var completedAt = ZonedDateTime.parse(c.get("completed_at").asString());
var completedAtString = c.get("completed_at").asString();
var completedAt = completedAtString != null ? ZonedDateTime.parse(completedAtString) : null;
switch (conclusion) {
case "cancelled" -> checkBuilder.cancel(completedAt);
case "success" -> checkBuilder.complete(true, completedAt);
case "action_required", "failure", "neutral" -> checkBuilder.complete(false, completedAt);
case "skipped" -> checkBuilder.skipped(completedAt);
case "stale" -> checkBuilder.stale();
default -> throw new IllegalStateException("Unexpected conclusion: " + conclusion);
}
}

1 comment on commit 2eb3dab

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 2eb3dab May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.