saltext.github.utils.gh.teams

Operations on GitHub organization teams.

Most functions take a team_info parameter, which is the team’s entry in the (cached) mapping returned by list_all(). Team-scoped caches (repositories, members) are attached to this entry.

saltext.github.utils.gh.teams.list_all(conn, *, owner=None, ignore_cache=False)[source]

Return all teams of an organization as a mapping of team name to team details (cached).

conn

GitHubConnection to use.

owner

Organization owning the teams. Defaults to the connection’s owner.

ignore_cache

Bypass the cached team list.

saltext.github.utils.gh.teams.get(conn, name, *, owner=None)[source]

Return the (cached) details of a single team, or None if it does not exist.

conn

GitHubConnection to use.

name

Team name.

owner

Organization owning the team. Defaults to the connection’s owner.

saltext.github.utils.gh.teams.find(conn, name, *, owner=None)[source]

Return a team’s cached details, raising when it does not exist. Teams are matched by exact display name first, then by slug and case-insensitive display name since GitHub derives team identity (the slug) case-insensitively.

conn

GitHubConnection to use.

name

Team name or slug.

owner

Organization owning the team. Defaults to the connection’s owner.

Raises GitHubNotFoundError if the team does not exist.

saltext.github.utils.gh.teams.create(conn, name, *, description=None, repo_names=None, privacy=None, permission=None, owner=None)[source]

Create a new team in the organization.

conn

GitHubConnection to use.

name

Name of team to create.

description

Team description.

repo_names

List of repository names to add the team to.

privacy

Privacy level for the team, either secret or closed.

permission

Default permission for new repositories added to the team, either pull, push or admin.

owner

Organization owning the team. Defaults to the connection’s owner.

saltext.github.utils.gh.teams.update(conn, team_info, name, *, description=None, privacy=None, permission=None, owner=None)[source]

Update an existing team.

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

name

Team name.

description

Team description.

privacy

Privacy level for the team, either secret or closed.

permission

Default permission for new repositories added to the team, either pull, push or admin.

owner

Organization owning the team. Defaults to the connection’s owner.

saltext.github.utils.gh.teams.delete(conn, team_info, *, owner=None)[source]

Delete a team from the organization.

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

owner

Organization owning the team. Defaults to the connection’s owner.

saltext.github.utils.gh.teams.list_repos(conn, team_info, *, owner=None, ignore_cache=False)[source]

Return the repositories of a team as a mapping of (lowercase) repository name to repository details (cached).

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

owner

Organization owning the team. Defaults to the connection’s owner.

ignore_cache

Bypass the cached team repositories.

saltext.github.utils.gh.teams.add_repo(conn, team_info, repo_name, permission=None, *, owner=None)[source]

Add a repository to a team, or update the permission the team has on it. Raises when updating the permission failed.

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

repo_name

Repository name to add.

permission

Permission for team members within the repository. Either pull, push or admin. Defaults to the default permission on the team.

owner

Organization owning the team. Defaults to the connection’s owner.

saltext.github.utils.gh.teams.remove_repo(conn, team_info, repo_name, *, owner=None)[source]

Remove a repository from a team.

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

repo_name

Repository name to remove.

owner

Organization owning the team. Defaults to the connection’s owner.

saltext.github.utils.gh.teams.list_members(conn, team_info, *, owner=None, ignore_cache=False)[source]

Return the (lowercase) logins of a team’s members (cached).

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

owner

Organization owning the team. Defaults to the connection’s owner.

ignore_cache

Bypass the cached team members.

saltext.github.utils.gh.teams.add_member(conn, team_info, login, *, owner=None)[source]

Add an organization member to a team.

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

login

User handle to invite.

owner

Organization owning the team. Defaults to the connection’s owner.

saltext.github.utils.gh.teams.remove_member(conn, team_info, login, *, owner=None)[source]

Remove a member from a team.

conn

GitHubConnection to use.

team_info

Team’s entry from list_all().

login

User handle to remove.

owner

Organization owning the team. Defaults to the connection’s owner.

Raises GitHubNotFoundError if the team or user does not exist.