Adds a team as a security manager for an organization.
by hugo697 ยท 10/25/2023
1
type Github = {
2
token: string;
3
};
4
/**
5
* Add a security manager team
6
* Adds a team as a security manager for an organization.
7
*/
8
export async function main(auth: Github, org: string, team_slug: string) {
9
const url = new URL(
10
`https://api.github.com/orgs/${org}/security-managers/teams/${team_slug}`
11
);
12
13
const response = await fetch(url, {
14
method: "PUT",
15
headers: {
16
Authorization: "Bearer " + auth.token,
17
},
18
body: undefined,
19
});
20
if (!response.ok) {
21
const text = await response.text();
22
throw new Error(`${response.status} ${text}`);
23
}
24
return await response.text();
25
26