Skip to content

Commit

Permalink
Consider GHE endpoint for Pages deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
BanzaiMan committed Jan 11, 2018
1 parent 5bac6ac commit b928ab6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/dpl/provider/pages.rb
Expand Up @@ -83,7 +83,12 @@ def verbose
def api # Borrowed from Releases provider
error 'gh-token must be provided for Pages provider to work.' unless @gh_token

@api ||= Octokit::Client.new(:access_token => @gh_token)
return @api if @api

api_opts = { :access_token => @gh_token }
api_opts[:api_endpoint] = "https://#{gh_url}/api/v3/" unless @gh_url.empty?

This comment has been minimized.

Copy link
@killuazhu

killuazhu Jan 11, 2018

This could be problematic. The default endpoint for github.com is https://api.github.com/ while for enterprise instance it's https://<your-github>/api/v3/

gh_url would always be set in previous code. If user decides to push to github.com, it would construct the api_endpoint to https://github.com/api/v3 instead of https://api.github.com/


@api = Octokit::Client.new(api_opts)
end

def user
Expand Down

0 comments on commit b928ab6

Please sign in to comment.