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 merging into deployable #120

Merged
merged 6 commits into from
Mar 26, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions lib/octopolo/scripts/deployable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,21 @@ def execute
CLI.say 'Pull request status checks have not passed. Cannot be marked deployable.'
exit!
end
if config.deployable_label
with_labelling do
merge
end
else
merge
end

merge_result = merge
add_deployable_label if config.deployable_label && merge_result
end
end

def merge
PullRequestMerger.perform Git::DEPLOYABLE_PREFIX, Integer(@pull_request_id), :user_notifications => config.user_notifications
PullRequestMerger.new(Git::DEPLOYABLE_PREFIX, Integer(@pull_request_id), :user_notifications => config.user_notifications).perform
end
private :merge

def with_labelling(&block)
def add_deployable_label
pull_request.add_labels(Deployable.deployable_label)
unless yield
pull_request.remove_labels(Deployable.deployable_label)
end
end
private :with_labelling
private :add_deployable_label

def deployable?
pull_request.mergeable? && pull_request.status_checks_passed?
Expand Down