Sha256: 2838849434132cdba9fc2c0a6842de5b84adfc54c14b2e385abd75fad7142487

Contents?: true

Size: 781 Bytes

Versions: 6

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

require_relative '../helpers/os_helper'
require_relative '../helpers/services_workflow_helper'

module Geet
  module Services
    # Add a comment to the PR for the current branch.
    #
    class CommentPr
      include Geet::Helpers::OsHelper
      include Geet::Helpers::ServicesWorkflowHelper

      DEFAULT_GIT_CLIENT = Geet::Utils::GitClient.new

      def initialize(repository, out: $stdout, git_client: DEFAULT_GIT_CLIENT)
        @repository = repository
        @out = out
        @git_client = git_client
      end

      def execute(comment, open_browser: false, **)
        pr = checked_find_branch_pr
        pr.comment(comment)
        open_file_with_default_application(pr.link) if open_browser
        pr
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
geet-0.22.0 lib/geet/services/comment_pr.rb
geet-0.21.0 lib/geet/services/comment_pr.rb
geet-0.19.0 lib/geet/services/comment_pr.rb
geet-0.18.0 lib/geet/services/comment_pr.rb
geet-0.17.0 lib/geet/services/comment_pr.rb
geet-0.16.0 lib/geet/services/comment_pr.rb