module Github::Repos::Commits
def commits(user_name=nil, repo_name=nil, params={})
@github.repos.commits('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 commits(user_name=nil, repo_name=nil, 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("/repos/#{user}/#{repo}/commits", params) return response unless block_given? response.each { |el| yield el } end
def create_comment(user_name=nil, repo_name=nil, params={})
@github.repos.create_comment(...)
@github = Github.new
= Examples
Creates a commit comment
def create_comment(user_name=nil, repo_name=nil, params={}) raise ArgumentError, "Expected following inputs to the method: #{REQUIRED_COMMENT_PARAMS.join(', ')}" unless _validate_inputs(REQUIRED_COMMENT_PARAMS, inputs) post("/repos/#{user}/#{repo}/commits/#{sha}/comments", inputs) end
def delete_comment(user, repo, comment_id)
@github.repos.delete_comment(...)
@github = Github.new
= Examples
Deletes a commit comment
def delete_comment(user, repo, comment_id) delete("/repos/#{user}/#{repo}/comments/#{comment_id}") end
def get_comment(user, repo, comment_id)
@github.repos.get_comment 'user-name', 'repo-name', 'comment-id'
@github = Github.new
= Examples
Gets a single commit comment
def get_comment(user, repo, comment_id) get("/repos/#{user}/#{repo}/comments/#{comment_id}") end
def get_commit(user, repo, sha)
@github.repos.get_commit('user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6')
@github = Github.new
Examples:
Gets a single commit
def get_commit(user, repo, sha) get("/repos/#{user}/#{repo}/commits/#{sha}") end
def get_commit(user, repo, sha)
Gets a single commit
def get_commit(user, repo, sha) get("/repos/#{user}/#{repo}/commits/#{sha}") end
def list_commit_comments(user, repo, sha)
@github.repos.list_commit_comments('user-name', 'repo-name', '6dcb09b5b57875f334f61aebed695e2e4193db5e')
@github = Github.new
= Examples
List comments for a single commit
def list_commit_comments(user, repo, sha) get("/repos/#{user}/#{repo}/commits/#{sha}/comments") end
def list_repo_comments(user_name=nil, repo_name=nil)
@github.repos.list_repo_comments('user-name', 'repo-name')
@github = Github.new
= Examples
List commit comments for a repository
def list_repo_comments(user_name=nil, repo_name=nil) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? response = get("/repos/#{user}/#{repo}/comments") return response unless block_given? response.each { |el| yield el } end
def update_comment(user, repo, comment_id)
@github.repos.update_comment(...)
@github = Github.new
= Examples
Update a commit comment
def update_comment(user, repo, comment_id) raise ArgumentError, "expected following inputs to the method: 'body'" unless _validate_inputs(["body"], inputs) patch("/repos/#{user}/#{repo}/comments/#{comment_id}") end