class Github::Orgs::Teams
def add_member(*args)
github.orgs.teams.add_member 'team-id', 'user-name'
github = Github.new :oauth_token => '...'
= Examples
In order to add a user to a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.
Add a team member
def add_member(*args) arguments(args, :required => [:team_id, :user]) put_request("/teams/#{team_id}/members/#{user}", arguments.params) end
def add_repo(*args)
github.orgs.teams.add_repo 'team-id', 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples
by the organization.
must be owned by the organization, or a direct for of a repo owned
an owner of the org that the team is associated with. Also, the repo
In order to add a repo to a team, the authenticated user must be
Add a team repository
def add_repo(*args) arguments(args, :required => [:team_id, :user, :repo]) put_request("/teams/#{team_id}/repos/#{user}/#{repo}", arguments.params) end
def create(*args)
]
"github/dotfiles"
"repo_names" => [
"permission" => "push",
"name" => "new team",
github.orgs.teams.create 'org-name',
github = Github.new :oauth_token => '...'
= Examples
* admin - team members can pull, push and administor these repositories.
* push - team members can pull and push, but not administor this repositores.
* pull - team members can pull, but not push or administor this repositories. Default
:permission - Optional string
:repo_names - Optional array of strings
:name - Required string
= Inputs
In order to create a team, the authenticated user must be an owner of:org.
Create a team
def create(*args) arguments(args, :required => [:org_name]) do sift VALID_TEAM_PARAM_NAMES assert_values VALID_TEAM_PARAM_VALUES assert_required %w[name] end post_request("/orgs/#{org_name}/teams", arguments.params) end
def delete(*args)
github.orgs.teams.delete 'team-id'
github = Github.new :oauth_token => '...'
= Examples
In order to delete a team, the authenticated user must be an owner of the org that the team is associated with
Delete a team
def delete(*args) arguments(args, :required => [:team_id]) delete_request("/teams/#{team_id}", arguments.params) end
def edit(*args)
"permission" => "push"
"name" => "new team name",
github.orgs.teams.edit 'team-id',
github = Github.new :oauth_token => '...'
= Examples
* admin - team members can pull, push and administor these repositories.
* push - team members can pull and push, but not administor this repositores.
* pull - team members can pull, but not push or administor this repositories. Default
:permission - Optional string
:name - Required string
= Inputs
In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.
Edit a team
def edit(*args) arguments(args, :required => [:team_id]) do sift VALID_TEAM_PARAM_NAMES assert_values VALID_TEAM_PARAM_VALUES assert_required %w[name] end patch_request("/teams/#{team_id}", arguments.params) end
def get(*args)
github.orgs.teams.get 'team-id'
github = Github.new :oauth_token => '...'
= Examples
Get a team
def get(*args) arguments(args, :required => [:team_id]) get_request("/teams/#{team_id}", arguments.params) end
def list(*args)
github.orgs.teams.list 'org-name'
github = Github.new :oauth_token => '...'
= Examples
List teams
def list(*args) arguments(args, :required => [:org_name]) response = get_request("/orgs/#{org_name}/teams", arguments.params) return response unless block_given? response.each { |el| yield el } end
def list_members(*args)
github.orgs.teams.list_members 'team-id' { |member| ... }
github.orgs.teams.list_members 'team-id'
github = Github.new :oauth_token => '...'
= Examples
In order to list members in a team, the authenticated user must be a member of the team.
List team members
def list_members(*args) arguments(args, :required => [:team_id]) response = get_request("/teams/#{team_id}/members", arguments.params) return response unless block_given? response.each { |el| yield el } end
def list_repos(*args)
github.orgs.teams.list_repos 'team-id'
github = Github.new :oauth_token => '...'
= Examples
List team repositories
def list_repos(*args) arguments(args, :required => [:team_id]) response = get_request("/teams/#{team_id}/repos", arguments.params) return response unless block_given? response.each { |el| yield el } end
def remove_member(*args)
github.orgs.teams.remove_member 'team-id', 'user-name'
github = Github.new :oauth_token => '...'
= Examples
note: This does not delete the user, it just remove them from the team.
the team is associated with.
have ‘admin’ permissions to the team or be an owner of the org that
In order to remove a user from a team, the authenticated user must
Remove a team member
def remove_member(*args) arguments(args, :required => [:team_id, :user]) delete_request("/teams/#{team_id}/members/#{user}", arguments.params) end
def remove_repo(*args)
github.orgs.teams.remove_repo 'team-id', 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples
note: This does not delete the repo, it just removes it from the team.
an owner of the org that the team is associated with.
In order to add a repo to a team, the authenticated user must be
Remove a team repository
def remove_repo(*args) arguments(args, :required => [:team_id, :user, :repo]) delete_request("/teams/#{team_id}/repos/#{user}/#{repo}", arguments.params) end
def team_member?(*args)
github.orgs.teams.team_member? 'team-id', 'user-name'
github = Github.new :oauth_token => '...'
= Examples
Check if a user is a member of a team
def team_member?(*args) arguments(args, :required => [:team_id, :user]) response = get_request("/teams/#{team_id}/members/#{user}", arguments.params) response.status == 204 rescue Github::Error::NotFound false end
def team_repo?(*args)
github.orgs.teams.team_repo? 'team-id', 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples
Check if a repository belongs to a team
def team_repo?(*args) arguments(args, :required => [:team_id, :user, :repo]) response = get_request("/teams/#{team_id}/repos/#{user}/#{repo}", arguments.params) response.status == 204 rescue Github::Error::NotFound false end