Class: Apadmi::Grout::FindTicketsToMoveAdoAction
- Inherits:
-
FindTicketsToMoveAction
- Object
- FindTicketsToMoveAction
- Apadmi::Grout::FindTicketsToMoveAdoAction
- Defined in:
- lib/apadmi/grout/actions/find_tickets_to_move_action/find_tickets_to_move_ado_action.rb
Overview
Finds and returns a list of all the issues that are ready to be moved Any tickets found that have the given status but *don't* appear ready to be moved will be flagged.
Instance Method Summary collapse
-
#initialize(ado_board_service, ticket_prefix, git_utils, issues_from_chnglg, logger) ⇒ FindTicketsToMoveAdoAction
constructor
A new instance of FindTicketsToMoveAdoAction.
-
#run(component, status, excluded_ticket_keys, custom_flag_messages = nil, options = nil) ⇒ Array<Apadmi::Grout::Issue>
The issues ready to move.
Constructor Details
#initialize(ado_board_service, ticket_prefix, git_utils, issues_from_chnglg, logger) ⇒ FindTicketsToMoveAdoAction
Returns a new instance of FindTicketsToMoveAdoAction.
16 17 18 19 20 21 22 |
# File 'lib/apadmi/grout/actions/find_tickets_to_move_action/find_tickets_to_move_ado_action.rb', line 16 def initialize(ado_board_service, ticket_prefix, git_utils, issues_from_chnglg, logger) @ado_board_service = ado_board_service @ticket_prefix = ticket_prefix @git_utils = git_utils @issues_from_changelog_action = issues_from_chnglg @logger = logger end |
Instance Method Details
#run(component, status, excluded_ticket_keys, custom_flag_messages = nil, options = nil) ⇒ Array<Apadmi::Grout::Issue>
Returns the issues ready to move.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/apadmi/grout/actions/find_tickets_to_move_action/find_tickets_to_move_ado_action.rb', line 30 def run( component, status, excluded_ticket_keys, = nil, = nil ) ||= Apadmi::Grout::FlagMessages.default(status) ||= Apadmi::Grout::AdoFindTicketsOptions.new(required_tags: [], not_tags: []) issues = @ado_board_service.search_unblocked_issues( component, status, [], ).reject { |issue| excluded_ticket_keys.include? issue.key } issue_keys = issues.map(&:key) @logger.("Found issues to consider #{issue_keys.join(", ")}") # Get the issues in the git changelog, filtered for the issues being considered changelog_ids = @issues_from_changelog_action.issue_ids_from_changelog( @git_utils.merge_changelog(issue_keys) ).map { |id| id.delete_prefix(@ticket_prefix) } @git_utils.fetch_all # issues that have been merged, but aren't in this build. # This is a valid state (e.g. merged into a release branch but not develop) invert_changelog_ids = @issues_from_changelog_action.issue_ids_from_changelog( @git_utils.invert_changelog(issue_keys) ).map { |id| id.delete_prefix(@ticket_prefix) } final_list = issues.filter do |issue| # Flag the ticket if it doesn't include in either changelog since # this means the ticket is likely in an incorrect state decide_should_include(changelog_ids, , invert_changelog_ids, issue) end @logger.("Final list: #{final_list.map(&:key).join(", ")}") final_list end |