From f2e76c5f907d88bf9cc31dce583968c095344d8a Mon Sep 17 00:00:00 2001
From: johndoe6345789
Date: Wed, 24 Dec 2025 20:58:58 +0000
Subject: [PATCH] Generated by Spark: Add auto-refresh every 30 seconds for
live build status
---
src/components/GitHubActionsFetcher.tsx | 56 +++++++++++++++++++++----
1 file changed, 48 insertions(+), 8 deletions(-)
diff --git a/src/components/GitHubActionsFetcher.tsx b/src/components/GitHubActionsFetcher.tsx
index 08612e16d..cab1c2043 100644
--- a/src/components/GitHubActionsFetcher.tsx
+++ b/src/components/GitHubActionsFetcher.tsx
@@ -26,6 +26,8 @@ export function GitHubActionsFetcher() {
const [error, setError] = useState(null)
const [lastFetched, setLastFetched] = useState(null)
const [needsAuth, setNeedsAuth] = useState(false)
+ const [secondsUntilRefresh, setSecondsUntilRefresh] = useState(30)
+ const [autoRefreshEnabled, setAutoRefreshEnabled] = useState(true)
const fetchGitHubActions = async () => {
setIsLoading(true)
@@ -50,6 +52,7 @@ export function GitHubActionsFetcher() {
setData(workflows.workflow_runs as WorkflowRun[])
setLastFetched(new Date())
+ setSecondsUntilRefresh(30)
toast.success(`Fetched ${workflows.workflow_runs.length} workflow runs`)
} catch (err) {
const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred'
@@ -64,6 +67,22 @@ export function GitHubActionsFetcher() {
fetchGitHubActions()
}, [])
+ useEffect(() => {
+ if (!autoRefreshEnabled) return
+
+ const countdownInterval = setInterval(() => {
+ setSecondsUntilRefresh((prev) => {
+ if (prev <= 1) {
+ fetchGitHubActions()
+ return 30
+ }
+ return prev - 1
+ })
+ }, 1000)
+
+ return () => clearInterval(countdownInterval)
+ }, [autoRefreshEnabled])
+
const getStatusColor = (status: string, conclusion: string | null) => {
if (status === 'completed') {
if (conclusion === 'success') return 'text-green-600'
@@ -131,14 +150,35 @@ export function GitHubActionsFetcher() {
Repository: johndoe6345789/metabuilder
-
+
+
+
+
+ Auto-refresh {autoRefreshEnabled ? 'ON' : 'OFF'}
+
+ {autoRefreshEnabled && (
+
+ Next refresh: {secondsUntilRefresh}s
+
+ )}
+
+
+
+
+
{conclusion && (