Skip to content

Commit

Permalink
Merge pull request #46 from thegarage/fix-updating-commit-status
Browse files Browse the repository at this point in the history
fix-updating-commit-status
  • Loading branch information
wireframe committed Apr 10, 2015
2 parents 04f7fc4 + e5e05a0 commit 6ef2893
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
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.

0 comments on commit 6ef2893

Please sign in to comment.