//native
/**
* Create Issue Comment
* Comment on an issue or pull request (pull requests share the issue comment thread).
*/
export async function main(
auth: RT.Github,
owner: string,
repo: string,
issue_number: number,
body: string
) {
const response = await fetch(
`https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/comments`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
},
body: JSON.stringify({ body }),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 2 hours ago