Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.pronto.yml configuration file #104

Merged
merged 10 commits into from
Oct 25, 2015
Prev Previous commit
Next Next commit
Move GITHUB_ACCESS_TOKEN environment variable to config
  • Loading branch information
mmozuras committed Oct 25, 2015
commit b21852bccc2a213117ddb428c9c2d5cff9a1529b
4 changes: 4 additions & 0 deletions lib/pronto/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def excluded_files
@excluded_files ||= exclude.flat_map { |path| Dir[path] }
end

def github_access_token
ENV['GITHUB_ACCESS_TOKEN'] || @config_file['github']['access_token']
end

def github_slug
@config_file['github']['slug']
end
Expand Down
7 changes: 2 additions & 5 deletions lib/pronto/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Pronto
class Github
def initialize(repo)
@repo = repo
@config = Config.new
@comment_cache = {}
@pull_id_cache = {}
end
Expand Down Expand Up @@ -45,7 +46,7 @@ def slug
end

def client
@client ||= Octokit::Client.new(access_token: access_token,
@client ||= Octokit::Client.new(access_token: @config.github_access_token,
auto_paginate: true)
end

Expand All @@ -65,10 +66,6 @@ def pull_id
end
end

def access_token
ENV['GITHUB_ACCESS_TOKEN']
end

Comment = Struct.new(:sha, :body, :path, :position) do
def ==(other)
position == other.position &&
Expand Down