diff --git a/src/components/GitHubActionsFetcher.tsx b/src/components/GitHubActionsFetcher.tsx index 44b681c4a..7a2268162 100644 --- a/src/components/GitHubActionsFetcher.tsx +++ b/src/components/GitHubActionsFetcher.tsx @@ -323,9 +323,21 @@ Format your response in clear markdown with code blocks for any suggested fixes. const inProgress = data.filter(r => r.status !== 'completed').length const mostRecent = data[0] - const mostRecentPassed = mostRecent?.status === 'completed' && mostRecent?.conclusion === 'success' - const mostRecentFailed = mostRecent?.status === 'completed' && mostRecent?.conclusion === 'failure' - const mostRecentRunning = mostRecent?.status !== 'completed' + const mostRecentTimestamp = new Date(mostRecent.updated_at).getTime() + const timeThreshold = 5 * 60 * 1000 + + const recentWorkflows = data.filter(r => { + const runTime = new Date(r.updated_at).getTime() + return Math.abs(runTime - mostRecentTimestamp) < timeThreshold + }) + + const hasAnyFailed = recentWorkflows.some(r => r.status === 'completed' && r.conclusion === 'failure') + const hasAnyRunning = recentWorkflows.some(r => r.status !== 'completed') + const allPassed = recentWorkflows.every(r => r.status === 'completed' && r.conclusion === 'success') + + const mostRecentPassed = allPassed && recentWorkflows.length > 0 + const mostRecentFailed = hasAnyFailed + const mostRecentRunning = hasAnyRunning && !hasAnyFailed const successRate = completed > 0 ? Math.round((successful / completed) * 100) : 0 const recentRuns = data.slice(0, 5) @@ -351,7 +363,8 @@ Format your response in clear markdown with code blocks for any suggested fixes. mostRecent, mostRecentPassed, mostRecentFailed, - mostRecentRunning + mostRecentRunning, + recentWorkflows } }, [data]) @@ -427,26 +440,53 @@ Format your response in clear markdown with code blocks for any suggested fixes. )}
- {conclusion.mostRecentPassed && 'Most Recent Build: PASSED ✓'} - {conclusion.mostRecentFailed && 'Most Recent Build: FAILED ✗'} - {conclusion.mostRecentRunning && 'Most Recent Build: RUNNING...'} + {conclusion.mostRecentPassed && 'Most Recent Builds: ALL PASSED ✓'} + {conclusion.mostRecentFailed && 'Most Recent Builds: FAILURES DETECTED ✗'} + {conclusion.mostRecentRunning && 'Most Recent Builds: RUNNING...'} - -
- {conclusion.mostRecent.name} -
-
- - Branch: - - {conclusion.mostRecent.head_branch} - - - - Updated: - {new Date(conclusion.mostRecent.updated_at).toLocaleString()} - + +
+ {conclusion.recentWorkflows.length > 1 ? ( + Showing {conclusion.recentWorkflows.length} workflows from the most recent run: + ) : ( + Most recent workflow: + )}
+ {conclusion.recentWorkflows.map((workflow) => ( +
+
+ {workflow.status === 'completed' && workflow.conclusion === 'success' && ( + + )} + {workflow.status === 'completed' && workflow.conclusion === 'failure' && ( + + )} + {workflow.status !== 'completed' && ( + + )} + {workflow.name} + + {workflow.status === 'completed' ? workflow.conclusion : workflow.status} + +
+
+ + Branch: + + {workflow.head_branch} + + + + Updated: + {new Date(workflow.updated_at).toLocaleString()} + +
+
+ ))}