Show job cobs on repo source and patches

This commit is contained in:
Rūdolfs Ošiņš
2026-04-21 17:29:39 +02:00
parent 7cef0618ce
commit 64f91fa41d
9 changed files with 265 additions and 21 deletions
+2
View File
@@ -2,6 +2,7 @@ import type { BaseUrl } from "./lib/fetcher.js";
import type {
Blob,
DiffResponse,
Job,
Remote,
Repo,
RepoListQuery,
@@ -71,6 +72,7 @@ export type {
HunkLine,
Issue,
IssueState,
Job,
LifecycleState,
Merge,
Patch,
+38
View File
@@ -125,6 +125,29 @@ const diffResponseSchema = object({
files: record(string(), diffBlobSchema),
});
const statusSchema = union([
literal("started"),
literal("failed"),
literal("succeeded"),
]);
const runSchema = object({
runId: string(),
node: authorSchema,
status: statusSchema,
log: string(),
});
const jobSchema = object({
jobId: string(),
commit: string(),
runs: array(runSchema),
});
export type Job = z.infer<typeof jobSchema>;
const jobsSchema = array(jobSchema) satisfies ZodSchema<Job[]>;
export type RepoListQuery = {
page?: number;
perPage?: number;
@@ -340,6 +363,21 @@ export class Client {
);
}
public async getJobsByCommit(
rid: string,
commit: string,
options?: RequestOptions,
): Promise<Job[]> {
return this.#fetcher.fetchOk(
{
method: "GET",
path: `repos/${rid}/xyz.radworks.job/${commit}`,
options,
},
jobsSchema,
);
}
public async getIssueById(
rid: string,
issueId: string,