def add_repository(self, team: Team, repo: str, permission: str) -> None: """ Adds repository to GitHub team with given permission """ click.echo(f"Adding repository {repo} with permission {permission} to {team.name}") github_repo = self.org.get_repo(repo) if not team.has_in_repos(github_repo): team.add_to_repos(github_repo) repo_name_for_update = f"{GITHUB_ORG}/{repo}" if not team.update_team_repository(repo_name_for_update, permission): raise ValueError(f"Changing permission to {permission} for repository {repo} was not successful")
def create_team(org, name, description, repo_names): # PyGithub creates secret teams, and has no way of turning that off! :( post_parameters = { "name": name, "description": description, "privacy": "closed", "permission": "push", "repo_names": repo_names } headers, data = org._requester.requestJsonAndCheck("POST", org.url + "/teams", input=post_parameters) return Team.Team(org._requester, headers, data, completed=True)