Skip to content

Commit

Permalink
Merge pull request #402 from Fryguy/pivotal_pr_checker_to_range_worker
Browse files Browse the repository at this point in the history
Change PivotalPrWorker to be a commit_range worker
  • Loading branch information
bdunne authored Feb 6, 2018
2 parents 57d06c1 + 15a7627 commit 901b839
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module CommitMonitorHandlers
module Commit
module CommitRange
class PivotalPrChecker
include Sidekiq::Worker
sidekiq_options :queue => :miq_bot
Expand All @@ -10,15 +10,15 @@ def self.handled_branch_modes
[:pr]
end

attr_reader :commit, :message

def perform(branch_id, commit, commit_details)
def perform(branch_id, new_commits)
return unless find_branch(branch_id, :pr)

@commit = commit
@message = commit_details["message"]
story_ids = new_commits.flat_map do |commit|
message = repo.git_service.commit(commit).full_message
PivotalService.ids_in_git_commit_message(message)
end

PivotalService.ids_in_git_commit_message(message).each do |story_id|
story_ids.uniq.each do |story_id|
update_pivotal_story(story_id)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pivotal_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def service

def self.ids_in_git_commit_message(message)
ids = []
message.each_line.collect do |line|
message.each_line do |line|
match = URL_REGEX.match(line)
ids << match[:id].to_i if match
end
Expand Down

0 comments on commit 901b839

Please sign in to comment.