mirror of
https://github.com/lukaszraczylo/ghtracker.git
synced 2026-10-14 00:58:36 +00:00
feat: add GitHub repository dashboard with Prometheus metrics
ghtracker authenticates as a GitHub App and scans a configured list of repositories on a schedule. It serves a dashboard, a JSON state endpoint, a health probe and Prometheus metrics. The dashboard lists only items that need attention: failing workflows, pull requests that wait too long or fail their checks, stale issues and projects that failed to scan. It has search, dynamic filters and a button that rescans on demand. The Vue app is embedded in the Go binary. The client protects the GitHub rate limit with conditional requests, a request reserve and Retry-After handling.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import type { TrackerState } from './types'
|
||||
|
||||
export async function fetchState(signal?: AbortSignal): Promise<TrackerState> {
|
||||
const res = await fetch('/api/state', { signal, headers: { Accept: 'application/json' } })
|
||||
if (!res.ok) throw new Error(`state request failed: HTTP ${res.status}`)
|
||||
return (await res.json()) as TrackerState
|
||||
}
|
||||
|
||||
/** Thrown when the server refuses a rescan because one ran recently. */
|
||||
export class RescanLimitedError extends Error {}
|
||||
|
||||
export async function requestRefresh(): Promise<void> {
|
||||
const res = await fetch('/refresh', { method: 'POST' })
|
||||
if (res.status === 429) throw new RescanLimitedError('Rescan is limited to once every 5 minutes')
|
||||
if (!res.ok) throw new Error(`rescan request failed: HTTP ${res.status}`)
|
||||
}
|
||||
Reference in New Issue
Block a user