Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix-updating-commit-status #46

Merged
merged 2 commits into from
Apr 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions lib/thegarage/gitx/cli/review_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ def assign_pull_request(pull_request)

def bump_pull_request(pull_request)
comment = comment_from_template(pull_request, BUMP_COMMENT_PREFIX, BUMP_COMMENT_FOOTER)
set_review_status('pending', 'Peer review in progress')
update_review_status(pull_request, 'pending', 'Peer review in progress')
end

def reject_pull_request(pull_request)
comment = comment_from_template(pull_request, REJECTION_COMMENT_PREFIX, REJECTION_COMMENT_FOOTER)
set_review_status('failure', 'Peer review rejected')
update_review_status(pull_request, 'failure', 'Peer review rejected')
end

def approve_pull_request(pull_request)
comment = comment_from_template(pull_request, APPROVAL_COMMENT_PREFIX, APPROVAL_COMMENT_FOOTER)
set_review_status('success', 'Peer review approved')
update_review_status(pull_request, 'success', 'Peer review approved')
end

def comment_from_template(pull_request, prefix, footer)
Expand All @@ -89,11 +89,6 @@ def comment_from_template(pull_request, prefix, footer)
comment = comment.gsub(footer, '').chomp.strip
github_client.add_comment(github_slug, pull_request.number, comment)
end

def set_review_status(state, description)
latest_commit = repo.head.target_id
update_review_status(latest_commit, state, description)
end
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/thegarage/gitx/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def branch_status(branch)
end

# Update build status with peer review status
def update_review_status(commit_sha, state, description)
def update_review_status(pull_request, state, description)
commit_sha = pull_request.head.sha
github_client.create_status(github_slug, commit_sha, state, context: REVIEW_CONTEXT, description: description)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/thegarage/gitx/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Thegarage
module Gitx
VERSION = '2.13.0'
VERSION = '2.13.1'
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.