Skip to content

Commit

Permalink
fix(github): apiBaseUrl for changelogs should append api/v3/ (#6325)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed May 25, 2020
1 parent df96e52 commit a5c1692
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap
Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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",
},
]
`;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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",
},
]
`;
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/pr/changelog/source-github.ts
Expand Up @@ -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');
Expand Down

0 comments on commit a5c1692

Please sign in to comment.