From a5c1692d67f23b7a01b9f76dc02f99618c2f9837 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Mon, 25 May 2020 18:46:53 +0200 Subject: [PATCH] fix(github): apiBaseUrl for changelogs should append api/v3/ (#6325) --- .../__snapshots__/index.spec.ts.snap | 40 +++++++++---------- lib/workers/pr/changelog/source-github.ts | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap index 3a46cd1756c9b0..140217746fc1ba 100644 --- a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap @@ -159,7 +159,7 @@ exports[`workers/pr/changelog getChangeLogJSON supports github enterprise and gi Object { "hasReleaseNotes": true, "project": Object { - "apiBaseUrl": "https://github-enterprise.example.com/", + "apiBaseUrl": "https://github-enterprise.example.com/api/v3/", "baseUrl": "https://github-enterprise.example.com/", "depName": "renovate", "github": "chalk/chalk", @@ -217,7 +217,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/tags?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/tags?per_page=100", }, Object { "headers": Object { @@ -228,7 +228,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -239,7 +239,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, Object { "headers": Object { @@ -250,7 +250,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -261,7 +261,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, Object { "headers": Object { @@ -272,7 +272,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -283,7 +283,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, Object { "headers": Object { @@ -294,7 +294,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -305,7 +305,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, ] `; @@ -469,7 +469,7 @@ exports[`workers/pr/changelog getChangeLogJSON supports github.com and github en Object { "hasReleaseNotes": true, "project": Object { - "apiBaseUrl": "https://github-enterprise.example.com/", + "apiBaseUrl": "https://github-enterprise.example.com/api/v3/", "baseUrl": "https://github-enterprise.example.com/", "depName": "renovate", "github": "chalk/chalk", @@ -527,7 +527,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/tags?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/tags?per_page=100", }, Object { "headers": Object { @@ -538,7 +538,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -549,7 +549,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, Object { "headers": Object { @@ -560,7 +560,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -571,7 +571,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, Object { "headers": Object { @@ -582,7 +582,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -593,7 +593,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, Object { "headers": Object { @@ -604,7 +604,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", }, Object { "headers": Object { @@ -615,7 +615,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/repos/chalk/chalk/releases?per_page=100", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/releases?per_page=100", }, ] `; diff --git a/lib/workers/pr/changelog/source-github.ts b/lib/workers/pr/changelog/source-github.ts index 629a55cb17172e..c3838e4b1c6e0e 100644 --- a/lib/workers/pr/changelog/source-github.ts +++ b/lib/workers/pr/changelog/source-github.ts @@ -81,7 +81,7 @@ export async function getChangeLogJSON({ } const apiBaseUrl = sourceUrl.startsWith('https://github.com/') ? 'https://api.github.com/' - : baseUrl; + : baseUrl + 'api/v3/'; const repository = pathname.slice(1).replace(/\/$/, ''); if (repository.split('/').length !== 2) { logger.debug({ sourceUrl }, 'Invalid github URL found');