type Github = {
token: string;
};
/**
* Create a check run
* **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: {
actions?: {
description: string;
identifier: string;
label: string;
[k: string]: unknown;
}[];
completed_at?: string;
conclusion?:
| "action_required"
| "cancelled"
| "failure"
| "neutral"
| "success"
| "skipped"
| "stale"
| "timed_out";
details_url?: string;
external_id?: string;
head_sha: string;
name: string;
output?: {
annotations?: {
annotation_level: "notice" | "warning" | "failure";
end_column?: number;
end_line: number;
message: string;
path: string;
raw_details?: string;
start_column?: number;
start_line: number;
title?: string;
[k: string]: unknown;
}[];
images?: {
alt: string;
caption?: string;
image_url: string;
[k: string]: unknown;
}[];
summary: string;
text?: string;
title: string;
[k: string]: unknown;
};
started_at?: string;
status?: "queued" | "in_progress" | "completed";
[k: string]: unknown;
} & (
| { status: "completed"; [k: string]: unknown }
| { status?: "queued" | "in_progress"; [k: string]: unknown }
)
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/check-runs`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 398 days ago
type Github = {
token: string;
};
/**
* Create a check run
* **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: {
actions?:
| []
| [
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
}
]
| [
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
}
]
| [
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
}
];
completed_at?: string;
conclusion?:
| "action_required"
| "cancelled"
| "failure"
| "neutral"
| "success"
| "skipped"
| "stale"
| "timed_out";
details_url?: string;
external_id?: string;
head_sha: string;
name: string;
output?: {
annotations?: {
annotation_level: "notice" | "warning" | "failure";
end_column?: number;
end_line: number;
message: string;
path: string;
raw_details?: string;
start_column?: number;
start_line: number;
title?: string;
[k: string]: unknown;
}[];
images?: {
alt: string;
caption?: string;
image_url: string;
[k: string]: unknown;
}[];
summary: string;
text?: string;
title: string;
[k: string]: unknown;
};
started_at?: string;
status?: "queued" | "in_progress" | "completed";
[k: string]: unknown;
} & (
| { status: "completed"; [k: string]: unknown }
| { status?: "queued" | "in_progress"; [k: string]: unknown }
)
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/check-runs`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 447 days ago
type Github = {
token: string;
};
/**
* Create a check run
* **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: {
actions?:
| []
| [
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
]
| [
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
]
| [
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
{
description: string;
identifier: string;
label: string;
[k: string]: unknown;
},
];
completed_at?: string;
conclusion?:
| "action_required"
| "cancelled"
| "failure"
| "neutral"
| "success"
| "skipped"
| "stale"
| "timed_out";
details_url?: string;
external_id?: string;
head_sha: string;
name: string;
output?: {
annotations?: {
annotation_level: "notice" | "warning" | "failure";
end_column?: number;
end_line: number;
message: string;
path: string;
raw_details?: string;
start_column?: number;
start_line: number;
title?: string;
[k: string]: unknown;
}[];
images?: {
alt: string;
caption?: string;
image_url: string;
[k: string]: unknown;
}[];
summary: string;
text?: string;
title: string;
[k: string]: unknown;
};
started_at?: string;
status?: "queued" | "in_progress" | "completed";
[k: string]: unknown;
} & (
| { status: "completed"; [k: string]: unknown }
| { status?: "queued" | "in_progress"; [k: string]: unknown }
)
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/check-runs`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 453 days ago