OPC # 0001: Gitea services

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
amadzarak
2026-04-25 19:35:46 -04:00
parent 76962a6af4
commit 65a6b4afaf
13 changed files with 457 additions and 93 deletions
+20 -2
View File
@@ -204,6 +204,22 @@ export async function getBranchCoverageForRepo(repoKey: string, hashes: string[]
return res.json();
}
// ── Changesets (paginated cross-repo commit log) ───────────────────────────────
// Reuses LinkedCommit shape — repoKey identifies which repo each commit came from.
export async function getChangesets(
page = 1,
limit = 25,
repo = 'all',
grep?: string,
): Promise<LinkedCommit[]> {
const params = new URLSearchParams({ page: String(page), limit: String(limit), repo });
if (grep) params.set('grep', grep);
const res = await fetch(`${BASE_URL}/api/git/log?${params}`);
if (!res.ok) throw new Error(`Failed to load changesets: ${res.statusText}`);
return res.json();
}
// ── Commit detail (full diff) ─────────────────────────────────────────────────
export interface CommitFile {
@@ -296,13 +312,15 @@ function mapArtifact(r: any): OpcArtifact {
// ── Gitea branch integration ───────────────────────────────────────────────────
export interface GiteaBranch {
repoKey?: string; // present when querying ?repo=all
name: string;
commitSha: string;
protected: boolean;
}
export async function listGiteaBranches(): Promise<GiteaBranch[]> {
const res = await fetch(`${BASE_URL}/api/gitea/branches`);
export async function listGiteaBranches(repoKey?: string): Promise<GiteaBranch[]> {
const params = repoKey ? `?repo=${encodeURIComponent(repoKey)}` : '';
const res = await fetch(`${BASE_URL}/api/gitea/branches${params}`);
if (!res.ok) throw new Error(`Failed to load Gitea branches: ${res.statusText}`);
return res.json();
}