type Github = {
token: string;
};
/**
* Delete a deployment branch policy
* Deletes a deployment branch policy for an environment.
You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `administration:write` permission for the repository to use this endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
environment_name: string,
branch_policy_id: string
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/environments/${environment_name}/deployment-branch-policies/${branch_policy_id}`
);
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 a deployment branch policy
* Deletes a deployment branch policy for an environment.
You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `administration:write` permission for the repository to use this endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
environment_name: string,
branch_policy_id: string
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/environments/${environment_name}/deployment-branch-policies/${branch_policy_id}`
);
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