From a08adb42911e4e84b35109d2cf207dbc2f958383 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Mon, 25 Jun 2018 20:01:22 +0200
Subject: [PATCH] =?UTF-8?q?fix:=20don=E2=80=99t=20replace=20github=20token?=
 =?UTF-8?q?=20if=20endpoint=20is=20api.github.com?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/datasource/github.js          | 5 ++++-
 lib/workers/pr/changelog/index.js | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/datasource/github.js b/lib/datasource/github.js
index ab1e6664d4..81f1493854 100644
--- a/lib/datasource/github.js
+++ b/lib/datasource/github.js
@@ -12,7 +12,10 @@ async function getDependency(purl, config) {
   let endpoint;
   let token;
   // istanbul ignore if
-  if (process.env.GITHUB_ENDPOINT) {
+  if (
+    process.env.GITHUB_ENDPOINT &&
+    process.env.GITHUB_ENDPOINT !== 'https://api.github.com/'
+  ) {
     logger.debug('Removing GHE token before retrieving node releases');
     endpoint = process.env.GITHUB_ENDPOINT;
     delete process.env.GITHUB_ENDPOINT;
diff --git a/lib/workers/pr/changelog/index.js b/lib/workers/pr/changelog/index.js
index 4517b9c95a..9bd8fc00c7 100644
--- a/lib/workers/pr/changelog/index.js
+++ b/lib/workers/pr/changelog/index.js
@@ -32,7 +32,10 @@ async function getChangeLogJSON(args) {
   let gheBaseURL;
   let githubBaseURL = 'https://github.com/';
 
-  if (process.env.GITHUB_ENDPOINT) {
+  if (
+    process.env.GITHUB_ENDPOINT &&
+    process.env.GITHUB_ENDPOINT !== 'https://api.github.com/'
+  ) {
     const parsedEndpoint = url.parse(process.env.GITHUB_ENDPOINT);
     gheBaseURL = `${parsedEndpoint.protocol}//${parsedEndpoint.hostname}/`;
     if (repositoryUrl.startsWith(gheBaseURL)) {
-- 
GitLab