Skip to content

Commit

Permalink
💡 allow the adding of security manager team
Browse files Browse the repository at this point in the history
* In addition to the syncing of the team...

This should have always been how it worked...
  • Loading branch information
JoshuaTheMiller committed May 9, 2023
1 parent 01d7072 commit 4097b9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/services/gitHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,18 @@ class InstalledGitHubClient implements InstalledClient {
public async AddSecurityManagerTeam(team: GitHubTeamName) {
const safeTeam = MakeTeamNameSafe(team);

await this.gitHubClient.rest.orgs.addSecurityManagerTeam({
org: this.orgName,
team_slug: safeTeam
})
try{
await this.gitHubClient.rest.orgs.addSecurityManagerTeam({
org: this.orgName,
team_slug: safeTeam
})
return true;
}
catch{
console.log(`Error adding ${team} as Security Managers for Org ${this.orgName}.`)
return false;
}

}

public async GetConfigurationForInstallation(): Response<OrgConfiguration> {
Expand Down
6 changes: 6 additions & 0 deletions src/services/githubSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ async function syncOrg(installedGitHubClient: InstalledClient, config: AppConfig
console.log(`Syncing Security Managers for ${installedGitHubClient.GetCurrentOrgName()}: ${t}`)
const orgMembers = await SynchronizeOrgMembers(installedGitHubClient, t, config);
await SynchronizeGitHubTeam(installedGitHubClient, t, config, orgMembers);

console.log(`Add Security Manager Team for ${installedGitHubClient.GetCurrentOrgName()}: ${t}`)
const addResult = await installedGitHubClient.AddSecurityManagerTeam(t);
if(addResult) {
console.log(`Added Security Manager Team for ${installedGitHubClient.GetCurrentOrgName()}: ${t}`)
}
}

response = {
Expand Down

0 comments on commit 4097b9b

Please sign in to comment.