class Github::Issues::Labels
def add(*args)
github.issues.labels.add 'user-name', 'repo-name', 'issue-id', 'label1', 'label2', ...
github = Github.new
= Examples
Add labels to an issue
def add(*args) arguments(args, :required => [:user, :repo, :issue_id]) params = arguments.params params['data'] = arguments.remaining unless arguments.remaining.empty? post_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels", params) end
def create(*args)
github.issues.labels.create name: 'API', color: 'FFFFFF'
github = Github.new user: 'user-name', repo: 'repo-name'
= Examples
:color - Required string - 6 character hex code, without leading #
:name - Required string
= Inputs
Create a label
def create(*args) arguments(args, :required => [:user, :repo]) do sift VALID_LABEL_INPUTS assert_required VALID_LABEL_INPUTS end post_request("/repos/#{user}/#{repo}/labels", arguments.params) end
def delete(*args)
github.issues.labels.delete 'user-name', 'repo-name', 'label-name'
github = Github.new
= Examples
Delete a label
def delete(*args) arguments(args, :required => [:user, :repo, :label_name]) delete_request("/repos/#{user}/#{repo}/labels/#{label_name}", arguments.params) end
def get(*args)
github.issues.labels.get label_name: 'bug'
github = Github.new user: 'user-name', repo: 'repo-name'
github.issues.labels.find 'user-name', 'repo-name', 'label-name'
github = Github.new
= Examples
Get a single label
def get(*args) arguments(args, :required => [:user, :repo, :label_name]) params = arguments.params get_request("/repos/#{user}/#{repo}/labels/#{label_name}", params) end
def list(*args)
github.issues.labels.list 'user-name', 'repo-name', issue_id: 'issue-id'
github = Github.new
= Examples
List labels on an issue
github.issues.labels.list 'user-name', 'repo-name', milestone_id: 'milestone-id'
github = Github.new
= Examples
Get labels for every issue in a milestone
github.issues.labels.list { |label| ... }
github.issues.labels.list
github = Github.new user: 'user-name', repo: 'repo-name'
= Examples
List all labels for a repository
def list(*args) arguments(args, :required => [:user, :repo]) params = arguments.params response = if (milestone_id = params.delete('milestone_id')) get_request("/repos/#{user}/#{repo}/milestones/#{milestone_id}/labels", params) elsif (issue_id = params.delete('issue_id')) get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels", params) else get_request("/repos/#{user}/#{repo}/labels", params) end return response unless block_given? response.each { |el| yield el } end
def remove(*args)
github.issues.labels.remove 'user-name', 'repo-name', 'issue-id'
github = Github.new
= Examples
Remove all labels from an issue
lable_name: 'label-name'
github.issues.labels.remove 'user-name', 'repo-name', 'issue-id',
github = Github.new
= Examples
Remove a label from an issue
def remove(*args) arguments(args, :required => [:user, :repo, :issue_id]) params = arguments.params if (label_name = params.delete('label_name')) delete_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels/#{label_name}", params) else delete_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels", params) end end
def replace(*args)
github.issues.labels.replace 'user-name', 'repo-name', 'issue-id', 'label1', 'label2', ...
github = Github.new
= Examples
Sending an empty array ([]) will remove all Labels from the Issue.
Replace all labels for an issue
def replace(*args) arguments(args, :required => [:user, :repo, :issue_id]) params = arguments.params params['data'] = arguments.remaining unless arguments.remaining.empty? put_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels", params) end
def update(*args)
name: 'API', color: "FFFFFF"
github.issues.labels.update 'user-name', 'repo-name', 'label-name',
github = Github.new
= Examples
:color - Required string-6 character hex code, without leading #
:name - Required string
= Inputs
Update a label
def update(*args) arguments(args, :required => [:user, :repo, :label_name]) do sift VALID_LABEL_INPUTS assert_required VALID_LABEL_INPUTS end patch_request("/repos/#{user}/#{repo}/labels/#{label_name}", arguments.params) end