GiteaPR: native iOS app to manage Gitea pull requests
Build iOS App / Build .ipa and publish source (push) Failing after 35s
Build iOS App / Build .ipa and publish source (push) Failing after 35s
Multi-repo PR inbox, review (approve/request changes/comment), merge with gating toggle, read-only diff viewer, and Gitea Actions check status with one-tap re-run. Ships unsigned via the iMac runner to the SideStore source.
This commit is contained in:
commit
1025634978
27 files changed
+2322
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import Foundation
|
||||
|
||||
/// Aggregate CI status across a PR's workflow runs.
|
||||
enum CIStatus: Equatable {
|
||||
case running
|
||||
case success
|
||||
case failure
|
||||
case cancelled
|
||||
case unknown
|
||||
|
||||
/// Runs are ordered newest-first. Any still running → running wins.
|
||||
/// Otherwise: any failure → failure, else success.
|
||||
static func from(runs: [ActionRun]) -> CIStatus {
|
||||
guard !runs.isEmpty else { return .unknown }
|
||||
var sawSuccess = false
|
||||
for run in runs {
|
||||
let conclusion = (run.conclusion ?? "").lowercased()
|
||||
if run.status?.lowercased() == "running"
|
||||
|| run.status?.lowercased() == "queued"
|
||||
|| run.status?.lowercased() == "waiting" {
|
||||
return .running
|
||||
}
|
||||
switch conclusion {
|
||||
case "success": sawSuccess = true
|
||||
case "failure", "cancelled":
|
||||
return conclusion == "cancelled" ? .cancelled : .failure
|
||||
default: continue
|
||||
}
|
||||
}
|
||||
return sawSuccess ? .success : .unknown
|
||||
}
|
||||
}
|
||||
|
||||
/// Aggregate review state across review submissions.
|
||||
enum ReviewState: Equatable {
|
||||
case approved
|
||||
case changesRequested
|
||||
case needsReview
|
||||
case unknown
|
||||
|
||||
static func from(reviews: [PullReview]) -> ReviewState {
|
||||
var hasReview = false
|
||||
for r in reviews {
|
||||
switch r.state.uppercased() {
|
||||
case "APPROVED": return .approved
|
||||
case "REQUEST_CHANGES": return .changesRequested
|
||||
default: hasReview = true
|
||||
}
|
||||
}
|
||||
return hasReview ? .needsReview : .unknown
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user