type Github = {
token: string;
};
/**
* Get a webhook delivery for an organization webhook
* Returns a delivery for a webhook configured in an organization.
*/
export async function main(
auth: Github,
org: string,
hook_id: string,
delivery_id: string
) {
const url = new URL(
`https://api.github.com/orgs/${org}/hooks/${hook_id}/deliveries/${delivery_id}`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 407 days ago