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.mostRecent.head_branch}
-
-
-
- Updated:
- {new Date(conclusion.mostRecent.updated_at).toLocaleString()}
-
+
+ {workflow.head_branch}
+
+
+
+ Updated:
+ {new Date(workflow.updated_at).toLocaleString()}
+
+