mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
Show job cobs on repo source and patches
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user