Files
indiekit-blog/_data/githubRepos.js
svemagie a6f87de59d chore: switch GitHub widget and changelog to Gitea
- Sidebar "GitHub" widget renamed to "Gitea", links point to gitea.giersig.eu/giersig.eu
- Runtime widget JS fetches commits/repos/PRs directly from Gitea API
- Build-time data files (githubActivity, githubRepos) switched from GitHub API to Gitea API
- changelog.njk fetches from Gitea API directly with client-side commit categorisation
- GITEA_URL / GITEA_ORG added to deploy.yml build env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 12:46:01 +02:00

42 lines
1.2 KiB
JavaScript

/**
* Gitea Repos Data
* Fetches public repositories from Gitea org API
*/
import { cachedFetch } from "../lib/data-fetch.js";
const GITEA_URL = process.env.GITEA_URL || "https://gitea.giersig.eu";
const GITEA_ORG = process.env.GITEA_ORG || "giersig.eu";
export default async function () {
try {
const url = `${GITEA_URL}/api/v1/orgs/${GITEA_ORG}/repos?limit=10&sort=newest`;
const repos = await cachedFetch(url, {
duration: "1h",
type: "json",
});
return repos
.filter((repo) => !repo.fork && !repo.private)
.map((repo) => ({
name: repo.name,
full_name: repo.full_name,
description: repo.description,
html_url: repo.html_url,
homepage: repo.website || repo.homepage,
language: repo.language,
stargazers_count: repo.stars_count || repo.stargazers_count || 0,
forks_count: repo.forks_count || 0,
open_issues_count: repo.open_issues_count || 0,
topics: repo.topics || [],
updated_at: repo.updated,
created_at: repo.created,
}))
.slice(0, 10);
} catch (error) {
console.error("Error fetching Gitea repos:", error.message);
return [];
}
}