Sha256: fc9c6702d5b45408fd289879f634f88ee8c03a444b8bb573f6f22bea312df026

Contents?: true

Size: 695 Bytes

Versions: 10

Compression:

Stored size: 695 Bytes

Contents

module ShopifyCLI
  module GitHub
    module IssueURLGenerator
      def self.error_url(error)
        title = "#{error.class}: #{error.message}"
        labels = "type:bug"
        content = File.read(File.join(ShopifyCLI::ROOT, ".github/ISSUE_TEMPLATE.md"))

        # take at most 5 lines from backtrace
        stacktrace = error.backtrace.length < 5 ? error.backtrace : error.backtrace[0..4]
        body = stacktrace.join("\n").to_s
        output = content.gsub(/<!--Stacktrace(.|\n)*-->/, body)
        query = URI.encode_www_form({ title: title, body: output, labels: labels })
        url = "#{ShopifyCLI::Constants::Links::NEW_ISSUE}?#{query}"
        url
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shopify-cli-2.10.2 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.10.1 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.10.0 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.9.0 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.8.0 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.7.4 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.7.3 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.7.2 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.7.1 lib/shopify_cli/github/issue_url_generator.rb
shopify-cli-2.7.0 lib/shopify_cli/github/issue_url_generator.rb