Sha256: d86c7e0bf580bd48deb947fe2b999453e4c3884e15e472d046c5937234a2480b

Contents?: true

Size: 779 Bytes

Versions: 5

Compression:

Stored size: 779 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, no_open_pr: nil, **)
        pr = checked_find_branch_pr
        pr.comment(comment)
        open_file_with_default_application(pr.link) unless no_open_pr
        pr
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geet-0.15.0 lib/geet/services/comment_pr.rb
geet-0.14.0 lib/geet/services/comment_pr.rb
geet-0.13.0 lib/geet/services/comment_pr.rb
geet-0.12.0 lib/geet/services/comment_pr.rb
geet-0.11.0 lib/geet/services/comment_pr.rb