//native
/**
* Regenerates a repository upload token and returns the new token
* Regenerates a repository upload token and returns the new token.
*/
export async function main(auth: RT.Sentry, owner: string, repository: string) {
const url = new URL(
`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/prevent/owner/${owner}/repository/${repository}/token/regenerate/`
)
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 235 days ago