//native
/**
* Get Current User
* Get the profile of the authenticated user.
*/
export async function main(auth: RT.Github) {
const response = await fetch("https://api.github.com/user", {
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 2 hours ago