type Github = {
token: string;
};
/**
* Fork a gist
*
*/
export async function main(auth: Github, gist_id: string) {
const url = new URL(`https://api.github.com/gists/${gist_id}/forks`);
const response = await fetch(url, {
method: "POST",
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 319 days ago