|
2 | 2 | import Base from '../layouts/Base.astro'; |
3 | 3 | import DynNum from '../components/DynNum.astro'; |
4 | 4 |
|
5 | | -// Forgejo — fetch commit counts at build time |
6 | | -const forgejoRepos = ['homelab-infra', 'homelab-configs', 'ansible-homelab', 'pixelium-site']; |
7 | | -let totalCommits = 278; |
8 | | -let journalEntries = 67; |
9 | | -try { |
10 | | - const base = 'https://forgejo.pixelium.internal/api/v1'; |
11 | | - const headers = { 'Authorization': `token ${import.meta.env.FORGEJO_TOKEN}` }; |
12 | | - const fetchOpts = { headers, ...(typeof process !== 'undefined' ? { agent: undefined } : {}) }; |
13 | | - const counts = await Promise.all(forgejoRepos.map(async (repo) => { |
14 | | - const res = await fetch(`${base}/repos/uzer/${repo}/commits?limit=1`, { headers }); |
15 | | - return parseInt(res.headers.get('x-total-count') || '0'); |
16 | | - })); |
17 | | - totalCommits = counts.reduce((a, b) => a + b, 0); |
18 | | - // Count journal entries from latest file |
19 | | - const journalRes = await fetch(`${base}/repos/uzer/homelab-infra/raw/journal/2026-03.md`, { headers }); |
20 | | - if (journalRes.ok) { |
21 | | - const text = await journalRes.text(); |
22 | | - journalEntries = (text.match(/^### /gm) || []).length; |
23 | | - } |
24 | | -} catch (_) {} |
| 5 | +// Commits and journal entries are now dynamic via DynNum (fed by kv-push.sh → KV) |
25 | 6 |
|
26 | 7 | const skills = [ |
27 | 8 | { |
@@ -89,11 +70,11 @@ const skills = [ |
89 | 70 | <p>Real numbers from our infrastructure — not estimates, not goals. Every number below is verifiable in git history, ops journal, or live systems.</p> |
90 | 71 | <div class="track-grid"> |
91 | 72 | <div class="track-stat"> |
92 | | - <span class="track-number">{totalCommits}+</span> |
93 | | - <span class="track-label">commits across 4 repos</span> |
| 73 | + <span class="track-number"><DynNum stat="forgejo_commits_total" fallback="350+" suffix="+" /></span> |
| 74 | + <span class="track-label">commits across repos</span> |
94 | 75 | </div> |
95 | 76 | <div class="track-stat"> |
96 | | - <span class="track-number">{journalEntries}</span> |
| 77 | + <span class="track-number"><DynNum stat="journal_entries" fallback="70+" suffix="+" /></span> |
97 | 78 | <span class="track-label">ops journal entries</span> |
98 | 79 | </div> |
99 | 80 | <div class="track-stat"> |
|
0 commit comments