Skip to content

Commit

Permalink
Change PivotalPrChecker to be a commit_range worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Feb 6, 2018
1 parent b0c5e4b commit 15a7627
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 15a7627

Please sign in to comment.