From fac0698d2713947b3dc4dc49eb9eb4618cf2fef7 Mon Sep 17 00:00:00 2001 From: Jason Morley Date: Fri, 2 Feb 2024 10:34:20 -1000 Subject: [PATCH] fix: Support the workflow run waiting state (#13) --- Builds/Model/ActionStatus.swift | 3 +++ Builds/Model/ApplicationModel.swift | 3 +-- Builds/Model/GitHub.swift | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Builds/Model/ActionStatus.swift b/Builds/Model/ActionStatus.swift index 91aadc1..a48d446 100644 --- a/Builds/Model/ActionStatus.swift +++ b/Builds/Model/ActionStatus.swift @@ -43,6 +43,9 @@ extension ActionStatus { guard let workflowRun = workflowRun else { return .gray } + if workflowRun.status == .waiting { + return .yellow + } if workflowRun.status == .inProgress { return .orange } diff --git a/Builds/Model/ApplicationModel.swift b/Builds/Model/ApplicationModel.swift index 748f65b..7305dff 100644 --- a/Builds/Model/ApplicationModel.swift +++ b/Builds/Model/ApplicationModel.swift @@ -68,7 +68,6 @@ class ApplicationModel: ObservableObject { func update(action: Action) async throws -> ActionStatus { let workflowRuns = try await client.workflowRuns(for: action.repositoryName) // TODO: Make a faulting filter. - print(workflowRuns) let latestRun = workflowRuns.first { workflowRun in if workflowRun.workflowId != action.workflowId { @@ -102,7 +101,7 @@ class ApplicationModel: ObservableObject { self.cachedStatus[action] = status } } catch { - print("FAILED WITH ERROR") + print("Failed to update with error \(error).") } } } diff --git a/Builds/Model/GitHub.swift b/Builds/Model/GitHub.swift index 7f0b5bb..41b44e6 100644 --- a/Builds/Model/GitHub.swift +++ b/Builds/Model/GitHub.swift @@ -140,6 +140,7 @@ class GitHub { } enum Status: String, Codable { + case waiting = "waiting" case inProgress = "in_progress" case completed = "completed" }