| 1 | /** The sync service's explicit removal marker; parse errors and branch-only files are not archives. */ |
| 2 | export function isArchivedWorkflow(workflow: { error: string | null }): boolean { |
| 3 | return workflow.error === "Its file is no longer on the default branch."; |
| 4 | } |
| 5 | |
| 6 | export function groupWorkflows<T extends { error: string | null }>(workflows: readonly T[]): { current: T[]; archived: T[] } { |
| 7 | const current: T[] = []; |
| 8 | const archived: T[] = []; |
| 9 | for (const workflow of workflows) (isArchivedWorkflow(workflow) ? archived : current).push(workflow); |
| 10 | return { current, archived }; |
| 11 | } |