diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index b9429f43d2..341a7520b9 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -37,13 +37,13 @@ module GitHub end def create_gist(files, description, private:) - url = "https://api.github.com/gists" + url = "#{API_URL}/gists" data = { "public" => !private, "files" => files, "description" => description } API.open_rest(url, data: data, scopes: CREATE_GIST_SCOPES)["html_url"] end def create_issue(repo, title, body) - url = "https://api.github.com/repos/#{repo}/issues" + url = "#{API_URL}/repos/#{repo}/issues" data = { "title" => title, "body" => body } API.open_rest(url, data: data, scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES)["html_url"] end diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index f0f0b85f18..b92d53d715 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -255,7 +255,7 @@ module GitHub def open_graphql(query, scopes: [].freeze) data = { query: query } - result = open_rest("https://api.github.com/graphql", scopes: scopes, data: data, request_method: "POST") + result = open_rest("#{API_URL}/graphql", scopes: scopes, data: data, request_method: "POST") if result["errors"].present? raise Error, result["errors"].map { |e|