type Github = {
token: string;
};
/**
* Enable or disable a security feature for an organization
* Enables or disables the specified security feature for all repositories in an organization.
*/
export async function main(
auth: Github,
org: string,
security_product:
| "dependency_graph"
| "dependabot_alerts"
| "dependabot_security_updates"
| "advanced_security"
| "secret_scanning"
| "secret_scanning_push_protection",
enablement: "enable_all" | "disable_all"
) {
const url = new URL(
`https://api.github.com/orgs/${org}/${security_product}/${enablement}`
);
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.text();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Enable or disable a security feature for an organization
* Enables or disables the specified security feature for all repositories in an organization.
*/
export async function main(
auth: Github,
org: string,
security_product:
| "dependency_graph"
| "dependabot_alerts"
| "dependabot_security_updates"
| "advanced_security"
| "secret_scanning"
| "secret_scanning_push_protection",
enablement: "enable_all" | "disable_all"
) {
const url = new URL(
`https://api.github.com/orgs/${org}/${security_product}/${enablement}`
);
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.text();
}
Submitted by hugo697 927 days ago