Reinstate User and Repo options
Trying to use github options to hold repo and user didn’t seem to work for all commands. Reverting those changes
This commit is contained in:
parent
01a0c05a02
commit
35b581240f
|
@ -16,14 +16,14 @@ module GitHubChangelogGenerator
|
|||
def initialize(options = {})
|
||||
@options = options || {}
|
||||
@github_token = fetch_github_token
|
||||
github_options = { per_page: PER_PAGE_NUMBER }
|
||||
github_options[:user] = @options[:user]
|
||||
github_options[:repo] = @options[:project]
|
||||
github_options[:oauth_token] = @github_token unless @github_token.nil?
|
||||
github_options[:endpoint] = @options[:github_endpoint] unless @options[:github_endpoint].nil?
|
||||
github_options[:site] = @options[:github_endpoint] unless @options[:github_site].nil?
|
||||
@github_options = { per_page: PER_PAGE_NUMBER }
|
||||
@github_options[:user] = @options[:user]
|
||||
@github_options[:repo] = @options[:project]
|
||||
@github_options[:oauth_token] = @github_token unless @github_token.nil?
|
||||
@github_options[:endpoint] = @options[:github_endpoint] unless @options[:github_endpoint].nil?
|
||||
@github_options[:site] = @options[:github_endpoint] unless @options[:github_site].nil?
|
||||
|
||||
@github = check_github_response { Github.new github_options }
|
||||
@github = check_github_response { Github.new @github_options }
|
||||
end
|
||||
|
||||
# Returns GitHub token. First try to use variable, provided by --token option,
|
||||
|
@ -65,7 +65,7 @@ module GitHubChangelogGenerator
|
|||
# @return [Array] array of tags in repo
|
||||
def github_fetch_tags
|
||||
tags = []
|
||||
response = @github.repos.tags
|
||||
response = @github.repos.tags @options[:user], @options[:project]
|
||||
page_i = 0
|
||||
count_pages = response.count_pages
|
||||
response.each_page do |page|
|
||||
|
@ -92,7 +92,9 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
|||
issues = []
|
||||
|
||||
begin
|
||||
response = @github.issues.list state: "closed",
|
||||
response = @github.issues.list user: @options[:user],
|
||||
repo: @options[:project],
|
||||
state: "closed",
|
||||
filter: "all",
|
||||
labels: nil
|
||||
page_i = 0
|
||||
|
@ -122,9 +124,13 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
|||
pull_requests = []
|
||||
begin
|
||||
if @options[:release_branch].nil?
|
||||
response = @github.pull_requests.list state: "closed"
|
||||
response = @github.pull_requests.list @options[:user],
|
||||
@options[:project],
|
||||
state: "closed"
|
||||
else
|
||||
response = @github.pull_requests.list state: "closed",
|
||||
response = @github.pull_requests.list @options[:user],
|
||||
@options[:project],
|
||||
state: "closed",
|
||||
base: @options[:release_branch]
|
||||
end
|
||||
page_i = 0
|
||||
|
@ -166,7 +172,9 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
|||
issues_slice.each do |issue|
|
||||
threads << Thread.new do
|
||||
begin
|
||||
response = @github.issues.events.list issue_number: issue["number"]
|
||||
response = @github.issues.events.list user: @options[:user],
|
||||
repo: @options[:project],
|
||||
issue_number: issue["number"]
|
||||
issue[:events] = []
|
||||
response.each_page do |page|
|
||||
issue[:events].concat(page)
|
||||
|
@ -193,8 +201,11 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
|||
# @param [Hash] tag
|
||||
# @return [Time] time of specified tag
|
||||
def fetch_date_of_tag(tag)
|
||||
puts @github_options
|
||||
begin
|
||||
commit_data = @github.git_data.commits.get tag["commit"]["sha"]
|
||||
commit_data = @github.git_data.commits.get @options[:user],
|
||||
@options[:project],
|
||||
tag["commit"]["sha"]
|
||||
rescue
|
||||
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
||||
end
|
||||
|
@ -205,7 +216,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
|||
# Fetch commit for specified event
|
||||
# @return [Hash]
|
||||
def fetch_commit(event)
|
||||
@github.git_data.commits.get event[:commit_id]
|
||||
@github.git_data.commits.get @options[:user], @options[:project], event[:commit_id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user