- Reorder projects: Poimen Orchestration → Memory → Homelab → RBC → AWS - Add Poimen (Ποιμήν) timeline card with Graph-RAG + Temporal pillars - Rewrite all 6 timeline cards: bold frameworks, quantified impact, emoji sections - Update Homelab card: production-grade framing, milestone-driven bullets - Fix CI status links: update API allowlist for riotpiao-poimen org repos - Fix commit SHA: Dockerfile NEXT_PUBLIC_COMMIT_SHA + CI --build-arg - Connect Poimen Memory card as 'the memory layer behind Poimen'
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
const FORGEJO_URL = 'https://forgejo.riotpiao.com'
|
|
const DEFAULT_REPO = 'rock/riotpiao.com'
|
|
const ALLOWED_REPOS = [
|
|
'rock/riotpiao.com',
|
|
'riotpiao-poimen/homelab',
|
|
'riotpiao-poimen/homelab-frontend',
|
|
'riotpiao-poimen/poimen',
|
|
'riotpiao-poimen/poimen-memory',
|
|
'riotpiao-poimen/poimen-workflows',
|
|
'riotpiao-poimen/kmsvc-manage',
|
|
]
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const repo = request.nextUrl.searchParams.get('repo') || DEFAULT_REPO
|
|
if (!ALLOWED_REPOS.includes(repo)) {
|
|
return NextResponse.json({ error: 'Repo not allowed' }, { status: 403 })
|
|
}
|
|
const token = process.env.FORGEJO_TOKEN
|
|
|
|
if (!token) {
|
|
return NextResponse.json(
|
|
{ error: 'FORGEJO_TOKEN not configured' },
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
|
|
try {
|
|
const response = await fetch(
|
|
`${FORGEJO_URL}/api/v1/repos/${repo}/actions/runs?limit=1`,
|
|
{
|
|
headers: {
|
|
Authorization: `token ${token}`,
|
|
Accept: 'application/json',
|
|
},
|
|
cache: 'no-store',
|
|
}
|
|
)
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`Forgejo API error: ${response.status}`)
|
|
}
|
|
|
|
const data = await response.json()
|
|
const latestRun = data.workflow_runs?.[0]
|
|
|
|
if (!latestRun) {
|
|
return NextResponse.json({
|
|
status: 'unknown',
|
|
message: 'No runs found',
|
|
})
|
|
}
|
|
|
|
return NextResponse.json({
|
|
status: latestRun.status,
|
|
conclusion: latestRun.conclusion,
|
|
sha: latestRun.head_sha,
|
|
title: latestRun.display_title || latestRun.head_branch,
|
|
branch: latestRun.head_branch,
|
|
url: latestRun.html_url,
|
|
updatedAt: latestRun.completed_at || latestRun.started_at,
|
|
})
|
|
} catch (error) {
|
|
console.error('CI status fetch error:', error)
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch CI status', status: 'error' },
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
}
|