Skip to content

Commit 5e80860

Browse files
ferr079claude
andcommitted
feat: live track record stats — Forgejo API at build time
- Fetch commit counts from 4 repos via Forgejo API (x-total-count header) - Fetch journal entry count from raw markdown (### pattern) - Fallback to last known values if API unreachable (GitHub CI/CD can't reach LAN) - deploy.yml: added FORGEJO_TOKEN secret - 213+ commits → 278+, 49 journal entries → 67 (live data) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent fb08928 commit 5e80860

3 files changed

Lines changed: 45 additions & 4 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
HTB_API_TOKEN: ${{ secrets.HTB_API_TOKEN }}
2222
ROOTME_API_KEY: ${{ secrets.ROOTME_API_KEY }}
2323
ROOTME_UID: ${{ secrets.ROOTME_UID }}
24+
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
2425

2526
- run: npx wrangler deploy
2627
env:

src/pages/about.astro

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
---
22
import Base from '../layouts/Base.astro';
33
4+
// Forgejo — fetch commit counts at build time
5+
const forgejoRepos = ['homelab-infra', 'homelab-configs', 'ansible-homelab', 'pixelium-site'];
6+
let totalCommits = 278;
7+
let journalEntries = 67;
8+
try {
9+
const base = 'https://forgejo.pixelium.internal/api/v1';
10+
const headers = { 'Authorization': `token ${import.meta.env.FORGEJO_TOKEN}` };
11+
const fetchOpts = { headers, ...(typeof process !== 'undefined' ? { agent: undefined } : {}) };
12+
const counts = await Promise.all(forgejoRepos.map(async (repo) => {
13+
const res = await fetch(`${base}/repos/uzer/${repo}/commits?limit=1`, { headers });
14+
return parseInt(res.headers.get('x-total-count') || '0');
15+
}));
16+
totalCommits = counts.reduce((a, b) => a + b, 0);
17+
// Count journal entries from latest file
18+
const journalRes = await fetch(`${base}/repos/uzer/homelab-infra/raw/journal/2026-03.md`, { headers });
19+
if (journalRes.ok) {
20+
const text = await journalRes.text();
21+
journalEntries = (text.match(/^### /gm) || []).length;
22+
}
23+
} catch (_) {}
24+
425
const skills = [
526
{
627
category: 'Infrastructure',
@@ -67,11 +88,11 @@ const skills = [
6788
<p>Real numbers from our infrastructure &mdash; not estimates, not goals. Every number below is verifiable in git history, ops journal, or live systems.</p>
6889
<div class="track-grid">
6990
<div class="track-stat">
70-
<span class="track-number">213+</span>
91+
<span class="track-number">{totalCommits}+</span>
7192
<span class="track-label">commits across 4 repos</span>
7293
</div>
7394
<div class="track-stat">
74-
<span class="track-number">49</span>
95+
<span class="track-number">{journalEntries}</span>
7596
<span class="track-label">ops journal entries</span>
7697
</div>
7798
<div class="track-stat">

src/pages/fr/about.astro

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
---
22
import Base from '../../layouts/Base.astro';
33
4+
// Forgejo — fetch commit counts at build time
5+
const forgejoRepos = ['homelab-infra', 'homelab-configs', 'ansible-homelab', 'pixelium-site'];
6+
let totalCommits = 278;
7+
let journalEntries = 67;
8+
try {
9+
const base = 'https://forgejo.pixelium.internal/api/v1';
10+
const headers = { 'Authorization': `token ${import.meta.env.FORGEJO_TOKEN}` };
11+
const counts = await Promise.all(forgejoRepos.map(async (repo) => {
12+
const res = await fetch(`${base}/repos/uzer/${repo}/commits?limit=1`, { headers });
13+
return parseInt(res.headers.get('x-total-count') || '0');
14+
}));
15+
totalCommits = counts.reduce((a, b) => a + b, 0);
16+
const journalRes = await fetch(`${base}/repos/uzer/homelab-infra/raw/journal/2026-03.md`, { headers });
17+
if (journalRes.ok) {
18+
const text = await journalRes.text();
19+
journalEntries = (text.match(/^### /gm) || []).length;
20+
}
21+
} catch (_) {}
22+
423
const skills = [
524
{
625
category: 'Infrastructure',
@@ -67,11 +86,11 @@ const skills = [
6786
<p>Des chiffres réels de notre infrastructure — pas des estimations, pas des objectifs. Chaque nombre ci-dessous est vérifiable dans l'historique git, le journal ops, ou les systèmes live.</p>
6887
<div class="track-grid">
6988
<div class="track-stat">
70-
<span class="track-number">213+</span>
89+
<span class="track-number">{totalCommits}+</span>
7190
<span class="track-label">commits sur 4 repos</span>
7291
</div>
7392
<div class="track-stat">
74-
<span class="track-number">49</span>
93+
<span class="track-number">{journalEntries}</span>
7594
<span class="track-label">entrées journal ops</span>
7695
</div>
7796
<div class="track-stat">

0 commit comments

Comments
 (0)