Browse Source

doc.fetch: read GITHUB_TOKEN also from ENV

Simon Legner 5 years ago
parent
commit
c25fbb4b3c
1 changed files with 2 additions and 0 deletions
  1. 2 0
      lib/docs/core/doc.rb

+ 2 - 0
lib/docs/core/doc.rb

@@ -220,6 +220,8 @@ module Docs
 
       if opts.key?(:github_token) and url.start_with?('https://api.github.com/')
         headers['Authorization'] = "token #{opts[:github_token]}"
+      elsif ENV['GITHUB_TOKEN'] and url.start_with?('https://api.github.com/')
+        headers['Authorization'] = "token #{ENV['GITHUB_TOKEN']}"
       end
 
       opts[:logger].debug("Fetching #{url}")