From 936b1915664d20c5081953e1eefffa30979a16ad Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Mon, 10 Nov 2014 14:40:10 +0200 Subject: [PATCH] Fix bug with wrong credentials in 1.0.1 (fixed #12) --- lib/github_changelog_generator.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index ace8eb1..f48c889 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -117,9 +117,14 @@ class ChangelogGenerator puts "Receive tags for repo #{url}" end - response = HTTParty.get(url, - :headers => {'Authorization' => "token #{@options[:token]}", - 'User-Agent' => 'Changelog-Generator'}) + if @options[:token] + response = HTTParty.get(url, + :headers => {'Authorization' => "token #{@options[:token]}", + 'User-Agent' => 'Changelog-Generator'}) + else + response = HTTParty.get(url, + :headers => {'User-Agent' => 'Changelog-Generator'}) + end json_parse = JSON.parse(response.body)