Files
gitea/ts/gitea.interfaces.ts

168 lines
4.2 KiB
TypeScript

// ---------------------------------------------------------------------------
// Common
// ---------------------------------------------------------------------------
export interface ITestConnectionResult {
ok: boolean;
error?: string;
}
export interface IListOptions {
search?: string;
page?: number;
perPage?: number;
}
// ---------------------------------------------------------------------------
// Action Run list options
// ---------------------------------------------------------------------------
export interface IActionRunListOptions extends IListOptions {
/** Filter by run status. Accepts normalized names (running, failed, etc.) — auto-translated to Gitea API values. */
status?: string;
/** Filter by head branch */
branch?: string;
/** Filter by trigger event (push, pull_request, schedule, workflow_dispatch, …) */
event?: string;
/** Filter by the user who triggered the run */
actor?: string;
}
// ---------------------------------------------------------------------------
// Users
// ---------------------------------------------------------------------------
export interface IGiteaUser {
id: number;
login: string;
login_name: string;
source_id: number;
full_name: string;
email: string;
avatar_url: string;
}
// ---------------------------------------------------------------------------
// Repositories (raw API response)
// ---------------------------------------------------------------------------
export interface IGiteaRepository {
id: number;
name: string;
full_name: string;
description: string;
default_branch: string;
html_url: string;
private: boolean;
topics: string[];
updated_at: string;
owner: {
id: number;
login: string;
avatar_url: string;
};
}
// ---------------------------------------------------------------------------
// Organizations (raw API response)
// ---------------------------------------------------------------------------
export interface IGiteaOrganization {
id: number;
name: string;
full_name: string;
description: string;
visibility: string;
repo_count: number;
avatar_url: string;
}
// ---------------------------------------------------------------------------
// Secrets
// ---------------------------------------------------------------------------
export interface IGiteaSecret {
name: string;
created_at: string;
}
// ---------------------------------------------------------------------------
// Action Runs (raw API response — aligned with Gitea 1.25 swagger)
// ---------------------------------------------------------------------------
export interface IGiteaActionRun {
id: number;
name: string;
workflow_id: string;
status: string; // run state: running, waiting, completed
conclusion: string; // result: success, failure, cancelled, skipped
head_branch: string;
head_sha: string;
html_url: string;
event: string;
path: string; // e.g. "workflow.yaml@refs/tags/v1.0"
display_title: string;
run_number: number;
run_attempt: number;
started_at: string;
completed_at: string;
actor: IGiteaUser;
trigger_actor: IGiteaUser;
repository: {
id: number;
name: string;
full_name: string;
html_url: string;
};
}
// ---------------------------------------------------------------------------
// Action Run Jobs (raw API response)
// ---------------------------------------------------------------------------
export interface IGiteaActionRunJob {
id: number;
run_id: number;
name: string;
workflow_name: string;
head_branch: string;
head_sha: string;
status: string;
conclusion: string;
html_url: string;
started_at: string;
completed_at: string;
steps: IGiteaActionRunJobStep[];
labels: string[];
runner_id: number;
runner_name: string;
}
export interface IGiteaActionRunJobStep {
name: string;
number: number;
status: string;
conclusion: string;
started_at: string;
completed_at: string;
}
// ---------------------------------------------------------------------------
// Branches & Tags
// ---------------------------------------------------------------------------
export interface IGiteaBranch {
name: string;
commit: {
id: string;
};
}
export interface IGiteaTag {
name: string;
id: string;
commit: {
sha: string;
};
}