class Github::Repos::Commits
def commit_comment(user_name, repo_name, comment_id, params={})
github.repos.commits.commit_comment 'user-name', 'repo-name', 'comment-id'
github = Github.new
= Examples
Gets a single commit comment
def commit_comment(user_name, repo_name, comment_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of comment_id _normalize_params_keys(params) get_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params) end
def commit_comments(user_name, repo_name, sha, params={})
github.repos.commits.commit_comments 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed695e2e4193db5e'
github = Github.new
= Examples
List comments for a single commit
def commit_comments(user_name, repo_name, sha, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of sha _normalize_params_keys(params) response = get_request("/repos/#{user}/#{repo}/commits/#{sha}/comments", params) return response unless block_given? response.each { |el| yield el } end
def compare(user_name, repo_name, base, head, params={})
'master'
'v0.4.8',
'repo-name',
'user-name',
github.repos.commits.compare
github = Github.new
= Examples
Compares two commits
def compare(user_name, repo_name, base, head, params={}) _validate_presence_of base, head _normalize_params_keys(params) get_request("/repos/#{user_name}/#{repo_name}/compare/#{base}...#{head}", params) end
def create_comment(user_name, repo_name, sha, params={})
"position" => 4
"path" => "file1.txt",
"line" => 1,
"commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"body" => "Nice change",
github.repos.commits.create_comment 'user-name', 'repo-name', 'sha-key',
github = Github.new
= Examples
* :position - Required number - Line index in the diff to comment on.
* :path - Required string - Relative path of the file to comment on.
* :line - Required number - Line number in the file to comment on.
* :comment_id - Required string - Sha of the commit to comment on.
* :body - Required string.
= Inputs
Creates a commit comment
def create_comment(user_name, repo_name, sha, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of sha _normalize_params_keys(params) _filter_params_keys(REQUIRED_COMMENT_PARAMS, params) _validate_inputs(REQUIRED_COMMENT_PARAMS, params) post_request("/repos/#{user}/#{repo}/commits/#{sha}/comments", params) end
def delete_comment(user_name, repo_name, comment_id, params={})
github.repos.commits.delete_comment 'user-name', 'repo-name', 'comment-id'
github = Github.new
= Examples
Deletes a commit comment
def delete_comment(user_name, repo_name, comment_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of comment_id _normalize_params_keys(params) delete_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params) end
def get(user_name, repo_name, sha, params={})
@github.repos.commits.get 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6')
@github = Github.new
= Examples
Gets a single commit
def get(user_name, repo_name, sha, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of sha _normalize_params_keys(params) get_request("/repos/#{user}/#{repo}/commits/#{sha}", params) end
def list(user_name, repo_name, params={})
github.repos.commits.list 'user-name', 'repo-name', :sha => '...' { |commit| ... }
github.repos.commits.list 'user-name', 'repo-name', :sha => '...'
github = Github.new
= Examples
* :path Optional string. Only commits containing this file path will be returned
* :sha Optional string. Sha or branch to start listing commits from.
= Parameters
List commits on a repository
def list(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _normalize_params_keys(params) _filter_params_keys(%w[ sha path], params) response = get_request("/repos/#{user}/#{repo}/commits", params) return response unless block_given? response.each { |el| yield el } end
def repo_comments(user_name, repo_name, params={})
github.repos.commits.repo_comments 'user-name', 'repo-name' { |com| ... }
github.repos.commits.repo_comments 'user-name', 'repo-name'
github = Github.new
= Examples
List commit comments for a repository
def repo_comments(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _normalize_params_keys(params) response = get_request("/repos/#{user}/#{repo}/comments", params) return response unless block_given? response.each { |el| yield el } end
def update_comment(user_name, repo_name, comment_id, params={})
'comment-id', "body" => "Nice change"
github.repos.commits.update_comment 'user-name', 'repo-name',
github = Github.new
= Examples
* :body - Required string.
= Inputs
Update a commit comment
def update_comment(user_name, repo_name, comment_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of comment_id _normalize_params_keys(params) _validate_inputs(%w[ body ], params) patch_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params) end