//native
type Circleci = {
token: string
}
/**
* Remove an environment variable
* Delete an environment variable from a context.
*/
export async function main(auth: Circleci, env_var_name: string, context_id: string) {
const url = new URL(
`https://circleci.com/api/v2/context/${context_id}/environment-variable/${env_var_name}`
)
const response = await fetch(url, {
method: 'DELETE',
headers: {
'Circle-Token': 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 537 days ago