OPC # 0001: Gitea services
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user