()
| 260 | } |
| 261 | |
| 262 | async listRuns(): Promise<WorkflowRunRecord[]> { |
| 263 | let entries: Dirent[]; |
| 264 | try { |
| 265 | entries = await fs.readdir(this.workflowsDir(), { withFileTypes: true }); |
| 266 | } catch { |
| 267 | return []; |
| 268 | } |
| 269 | |
| 270 | const runs = await Promise.all( |
| 271 | entries |
| 272 | .filter((entry) => entry.isDirectory()) |
| 273 | .map(async (entry): Promise<WorkflowRunRecord | null> => { |
| 274 | try { |
| 275 | return await this.getRun(entry.name); |
| 276 | } catch (error) { |
| 277 | log.warn(`Skipping unreadable workflow run '${entry.name}': ${getErrorMessage(error)}`); |
| 278 | return null; |
| 279 | } |
| 280 | }) |
| 281 | ); |
| 282 | |
| 283 | return runs |
| 284 | .filter((run): run is WorkflowRunRecord => run != null) |
| 285 | .sort((a, b) => a.createdAt.localeCompare(b.createdAt)); |
| 286 | } |
| 287 | |
| 288 | async appendNextEvent( |
| 289 | runId: string, |
no test coverage detected