Skip to content

Commit

Permalink
fix: Support the workflow run waiting state (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmorley authored Feb 2, 2024
1 parent 4f3dcc9 commit fac0698
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Builds/Model/ActionStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions Builds/Model/ApplicationModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -102,7 +101,7 @@ class ApplicationModel: ObservableObject {
self.cachedStatus[action] = status
}
} catch {
print("FAILED WITH ERROR")
print("Failed to update with error \(error).")
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Builds/Model/GitHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class GitHub {
}

enum Status: String, Codable {
case waiting = "waiting"
case inProgress = "in_progress"
case completed = "completed"
}
Expand Down

0 comments on commit fac0698

Please sign in to comment.