type Github = {
token: string;
};
/**
* Add labels to an issue
*
*/
export async function main(
auth: Github,
owner: string,
repo: string,
issue_number: string,
body:
| { labels?: string[]; [k: string]: unknown }
| string[]
| {
labels?: { name: string; [k: string]: unknown }[];
[k: string]: unknown;
}
| { name: string; [k: string]: unknown }[]
| string
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/labels`
);
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 265 days ago
type Github = {
token: string;
};
/**
* Add labels to an issue
*
*/
export async function main(
auth: Github,
owner: string,
repo: string,
issue_number: string,
body:
| { labels?: [string, ...string[]]; [k: string]: unknown }
| [string, ...string[]]
| {
labels?: [
{ name: string; [k: string]: unknown },
...{ name: string; [k: string]: unknown }[]
];
[k: string]: unknown;
}
| [
{ name: string; [k: string]: unknown },
...{ name: string; [k: string]: unknown }[]
]
| string
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/labels`
);
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 314 days ago
type Github = {
token: string;
};
/**
* Add labels to an issue
*
*/
export async function main(
auth: Github,
owner: string,
repo: string,
issue_number: string,
body:
| { labels?: [string, ...string[]]; [k: string]: unknown }
| [string, ...string[]]
| {
labels?: [
{ name: string; [k: string]: unknown },
...{ name: string; [k: string]: unknown }[],
];
[k: string]: unknown;
}
| [
{ name: string; [k: string]: unknown },
...{ name: string; [k: string]: unknown }[],
]
| string
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/labels`
);
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 319 days ago