Sha256: 31e5e73092e1fac62e1c1056496d1245768bccc090e72ea9be720bfbd978b8c9

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

require 'octokit'

Octokit.auto_paginate = true

module PairingMatrix
  class GithubCommitReader < CommitReader
    def initialize(config)
      super(config)
      @github_client = github_client
    end

    def read(since)
      @config.github_repos.map do |repo|
        puts "Fetching commits since #{since} for #{repo}"
        commits = @github_client.commits_since(repo, since).map { |commit| commit.commit.message }
        puts "Total commits: #{commits.size}"
        commits
      end.flatten
    end

    private
    def github_client
      if @config.has_github_access_token?
        Octokit::Client.new(:access_token => @config.github_access_token)
      else
        Octokit::Client.new
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pairing_matrix-1.0.1 lib/pairing_matrix/github_commit_reader.rb
pairing_matrix-1.0 lib/pairing_matrix/github_commit_reader.rb