type Github = {
token: string;
};
/**
* Delete an environment variable
* Deletes an environment variable using the variable name.
You must authenticate using an access token with the `repo` scope to use this endpoint.
GitHub Apps must have the `environment:write` repository permission to use this endpoint.
*/
export async function main(
auth: Github,
repository_id: string,
name: string,
environment_name: string
) {
const url = new URL(
`https://api.github.com/repositories/${repository_id}/environments/${environment_name}/variables/${name}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Delete an environment variable
* Deletes an environment variable using the variable name.
You must authenticate using an access token with the `repo` scope to use this endpoint.
GitHub Apps must have the `environment:write` repository permission to use this endpoint.
*/
export async function main(
auth: Github,
repository_id: string,
name: string,
environment_name: string
) {
const url = new URL(
`https://api.github.com/repositories/${repository_id}/environments/${environment_name}/variables/${name}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 927 days ago