<commit_before>module Wf
  module Wrapper
    module Github
      module_function

      NAMESPACE = 'uniwebru'
      PROJECT = 'Obruset'

      include Cmd

      def github
        raise 'Установите переменную среды GITHUB_BASIC_AUTH' unless ENV['GITHUB_BASIC_AUTH']
        @github = ::Github.new basic_auth: ENV['GITHUB_BASIC_AUTH']
      end

      def create_pull_request comment, to_branch
        run 'hub', 'pull-request -m :comment -b :to_branch', with: {comment: comment, to_branch: to_branch}
      end

      def github_open_pull_requests
        github_pull_requests.list(state: 'open', auto_pagination: true)
      end

      def github_pull_request(number)
        github.pull_requests.get(NAMESPACE, PROJECT, number.to_i)
      end

      def github_pull_requests
        github.pull_requests(user: NAMESPACE, repo: PROJECT)
      end

      def github_pull_request_merge(number)
        github.pull_requests.merge(NAMESPACE, PROJECT, number.to_i)
      end

      def hub_check?
        run 'hub', '--version', return: :bool
      end
    end
  end
end<commit_msg>WF-1 #resolve-issue<commit_after>module Wf
  module Wrapper
    # github API wrapper
    module Github
      module_function

      NAMESPACE = 'uniwebru'.freeze
      PROJECT = 'Obruset'.freeze

      def github
        raise 'Установите переменную среды GITHUB_BASIC_AUTH' unless ENV['GITHUB_BASIC_AUTH']
        @github = ::Github.new basic_auth: ENV['GITHUB_BASIC_AUTH']
      end

      def create_pull_request(comment, to_branch)
        Cmd.run 'hub', 'pull-request -m :comment -b :to_branch', with: { comment: comment, to_branch: to_branch }
      end

      def github_open_pull_requests
        github_pull_requests.list(state: 'open', auto_pagination: true)
      end

      def github_pull_request(number)
        github.pull_requests.get(NAMESPACE, PROJECT, number.to_i)
      end

      def github_pull_requests
        github.pull_requests(user: NAMESPACE, repo: PROJECT)
      end

      def github_pull_request_merge(number)
        github.pull_requests.merge(NAMESPACE, PROJECT, number.to_i)
      end

      def hub_check?
        Cmd.run 'hub', '--version', return: :bool
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08268968650613358, 'fraction_numerical': 0.00045433893684688776, 'mean_word_length': 2.7448979591836733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3592191', 'n_tokens_mistral': 748, 'n_tokens_neox': 719, 'n_words': 162}