Sha256: 050654e5c41ad74b755b3d94a5eba6d759159856291eccfe7fc2f4fd1a6b0592
Contents?: true
Size: 1.95 KB
Versions: 17
Compression:
Stored size: 1.95 KB
Contents
# frozen_string_literal: true require_relative 'base' module Gitlab module Triage module Action class Summarize < Base class Dry < Summarize private def perform if group_summary_without_destination? puts Gitlab::Triage::UI.warn("No issue will be created: No summary destination specified when source is 'groups'.") return end puts "The following issue would be created in project `#{destination}` for the rule **#{policy.name}**:\n\n" puts ">>>" puts "* Title: #{issue.title}" puts "* Description: #{issue.description}" puts ">>>" end end def act perform if issue.valid? end private def perform if group_summary_without_destination? puts Gitlab::Triage::UI.warn("Issue was not created: No summary destination specified when source is 'groups'.") return end network.post_api(post_issue_url, post_issue_body) end def issue @issue ||= policy.build_issue end def destination issue.destination || network.options.source_id end def group_summary_without_destination? network.options.source == :groups && !issue.destination end def post_issue_url # POST /projects/:id/issues # https://docs.gitlab.com/ee/api/issues.html#new-issue post_url = UrlBuilders::UrlBuilder.new( network_options: network.options, source_id: destination, resource_type: 'issues' ).build puts Gitlab::Triage::UI.debug "post_issue_url: #{post_url}" if network.options.debug post_url end def post_issue_body { title: issue.title, description: issue.description } end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems