type Github = {
token: string;
};
/**
* Create a tag object
* Note that creating a tag object does not create the reference that makes a tag in Git.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: {
message: string;
object: string;
tag: string;
tagger?: {
date?: string;
email: string;
name: string;
[k: string]: unknown;
};
type: "commit" | "tree" | "blob";
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}/git/tags`);
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 367 days ago
type Github = {
token: string;
};
/**
* Create a tag object
* Note that creating a tag object does not create the reference that makes a tag in Git.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: {
message: string;
object: string;
tag: string;
tagger?: {
date?: string;
email: string;
name: string;
[k: string]: unknown;
};
type: "commit" | "tree" | "blob";
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}/git/tags`);
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 927 days ago