<commit_before>require 'octokit'

module Strava
  module L10n
    class GitHubApi

      def initialize(login, oauth_token)
        @client = Octokit::Client.new(login: login, oauth_token: oauth_token)
      end

      def tags(repo)
        @client.tags(repo)
      end

      def tree(repo, sha)
        @client.tree(repo, sha, recursive: 1)
      end

      def blob(repo, sha)
        @client.blob(repo, sha)
      end

      def commit(repo, path, content)
        blob = @client.create_blob repo, content
        master = @client.ref repo, 'heads/master'
        base_commit = @client.commit repo, master[:object][:sha]
        tree = @client.create_tree repo,
                                   [{ path: path, mode: '100644', type: 'blob', sha: blob }],
                                   options = {base_tree: base_commit[:commit][:tree][:sha]}
        commit = @client.create_commit repo, "Updating translations for #{path}", tree[:sha],
                                       parents=master[:object][:sha]
        @client.update_ref repo, 'heads/master', commit[:sha]
      end

      def get_commit(repo, sha)
        @client.commit(repo, sha)
      end

    end
  end
end<commit_msg>Skip Travis-CI builds for localization changes<commit_after>require 'octokit'

module Strava
  module L10n
    class GitHubApi

      def initialize(login, oauth_token)
        @client = Octokit::Client.new(login: login, oauth_token: oauth_token)
      end

      def tags(repo)
        @client.tags(repo)
      end

      def tree(repo, sha)
        @client.tree(repo, sha, recursive: 1)
      end

      def blob(repo, sha)
        @client.blob(repo, sha)
      end

      def commit(repo, path, content)
        blob = @client.create_blob repo, content
        master = @client.ref repo, 'heads/master'
        base_commit = @client.commit repo, master[:object][:sha]
        tree = @client.create_tree repo,
                                   [{ path: path, mode: '100644', type: 'blob', sha: blob }],
                                   options = {base_tree: base_commit[:commit][:tree][:sha]}
        commit = @client.create_commit repo, "Updating translations for #{path} [skip ci]", tree[:sha],
                                       parents=master[:object][:sha]
        @client.update_ref repo, 'heads/master', commit[:sha]
      end

      def get_commit(repo, sha)
        @client.commit(repo, sha)
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.11549527332511303, 'fraction_numerical': 0.007398273736128237, 'mean_word_length': 2.0236024844720495, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '640463', 'n_tokens_mistral': 748, 'n_tokens_neox': 709, 'n_words': 182}