diff --git a/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap index 78cc599f80058cf873fc38480a4756d2048a03c2..33780900373965643d478e8da0b61a606f975e67 100644 --- a/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap @@ -54,7 +54,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tags", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tags?per_page=100", }, Object { "headers": Object { @@ -65,7 +65,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -87,7 +87,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -109,7 +109,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -131,7 +131,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -260,7 +260,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tags", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tags?per_page=100", }, Object { "headers": Object { @@ -271,7 +271,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -293,7 +293,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -315,7 +315,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -337,7 +337,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -407,7 +407,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tags", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tags?per_page=100", }, Object { "headers": Object { @@ -418,7 +418,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -440,7 +440,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -462,7 +462,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { @@ -484,7 +484,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/meno/dropzone/repository/tree/", + "url": "https://gitlab.com/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100", }, Object { "headers": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap index 1907c0668829869ad02c00027aed2c1007029f3e..9d27414a2ad0b31f469f797b99ed77eded08a581 100644 --- a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap @@ -73,7 +73,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", }, Object { "headers": Object { @@ -95,7 +95,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", }, Object { "headers": Object { @@ -117,7 +117,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", }, Object { "headers": Object { @@ -139,7 +139,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", }, Object { "headers": Object { @@ -228,7 +228,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -250,7 +261,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -272,7 +294,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -294,7 +327,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -383,7 +427,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -405,7 +460,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -427,7 +493,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -449,7 +526,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -538,7 +626,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -560,7 +659,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -582,7 +692,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -604,7 +725,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/contents/", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "github-enterprise.example.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://github-enterprise.example.com/api/v3/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -748,7 +880,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -770,7 +913,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -792,7 +946,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { @@ -814,7 +979,18 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/chalk/contents/", + "url": "https://api.github.com/repos/chalk/chalk", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "authorization": "token abc", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/chalk/chalk/git/trees/master", }, Object { "headers": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap index 5d3ba16627c2374586c31ee32e26eba6d5442a45..340190a1ad0899ab1bbfb3b03ff41540ba2f7e0a 100644 --- a/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap @@ -249,6 +249,30 @@ Array [ `; exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "host": "gitlab.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/itentialopensource%2fadapter-utils/repository/tree?per_page=100", + }, + Object { + "headers": Object { + "accept-encoding": "gzip, deflate", + "host": "gitlab.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/itentialopensource%2fadapter-utils/repository/blobs/abcd/raw", + }, +] +`; + +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 2`] = ` Object { "body": "- add new auth, fix accept header and base path in mock @@ -262,32 +286,42 @@ See merge request itentialopensource/adapter-utils!177 } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 1`] = ` Array [ Object { "headers": Object { - "accept": "application/json", + "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate", - "host": "gitlab.com", + "host": "api.github.com", "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/itentialopensource/adapter-utils/repository/tree/", + "url": "https://api.github.com/repos/yargs/yargs", }, Object { "headers": Object { - "accept": "application/json", + "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate", - "host": "gitlab.com", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/yargs/yargs/git/trees/main", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "host": "api.github.com", "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/itentialopensource/adapter-utils/repository/files/CHANGELOG.md?ref=master", + "url": "https://api.github.com/repos/yargs/yargs/git/blobs/abcd", }, ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 2`] = ` Object { "body": "##### âš BREAKING CHANGES @@ -317,7 +351,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 1`] = ` Array [ Object { "headers": Object { @@ -327,7 +361,17 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/yargs/yargs/contents/", + "url": "https://api.github.com/repos/yargs/yargs", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/yargs/yargs/git/trees/main", }, Object { "headers": Object { @@ -337,12 +381,12 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/yargs/yargs/contents/CHANGELOG.md", + "url": "https://api.github.com/repos/yargs/yargs/git/blobs/abcd", }, ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 2`] = ` Object { "body": "##### Features @@ -357,7 +401,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles bad markdown 1`] = ` Array [ Object { "headers": Object { @@ -367,7 +411,17 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/yargs/yargs/contents/", + "url": "https://api.github.com/repos/some/repository2", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/some/repository2/git/trees/master", }, Object { "headers": Object { @@ -377,12 +431,12 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/yargs/yargs/contents/CHANGELOG.md", + "url": "https://api.github.com/repos/some/repository2/git/blobs/abcd", }, ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles bad markdown 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles files mismatch 1`] = ` Array [ Object { "headers": Object { @@ -392,7 +446,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repository2/contents/", + "url": "https://api.github.com/repos/chalk", }, Object { "headers": Object { @@ -402,12 +456,12 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repository2/contents/CHANGELOG.md", + "url": "https://api.github.com/repos/chalk/git/trees/master", }, ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles files mismatch 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles wrong format 1`] = ` Array [ Object { "headers": Object { @@ -417,13 +471,8 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/chalk/contents/", + "url": "https://api.github.com/repos/some/repository1", }, -] -`; - -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles wrong format 1`] = ` -Array [ Object { "headers": Object { "accept": "application/vnd.github.v3+json", @@ -432,7 +481,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repository1/contents/", + "url": "https://api.github.com/repos/some/repository1/git/trees/master", }, Object { "headers": Object { @@ -442,7 +491,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repository1/contents/CHANGELOG.md", + "url": "https://api.github.com/repos/some/repository1/git/blobs/abcd", }, ] `; @@ -487,7 +536,17 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/angular/angular.js/contents/", + "url": "https://api.github.com/repos/angular/angular.js", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/angular/angular.js/git/trees/master", }, Object { "headers": Object { @@ -497,12 +556,36 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/angular/angular.js/contents/CHANGELOG.md", + "url": "https://api.github.com/repos/angular/angular.js/git/blobs/abcd", }, ] `; exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "host": "api.gitlab.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.gitlab.com/projects/gitlab-org%2fgitter%2fwebapp/repository/tree?per_page=100", + }, + Object { + "headers": Object { + "accept-encoding": "gzip, deflate", + "host": "api.gitlab.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.gitlab.com/projects/gitlab-org%2fgitter%2fwebapp/repository/blobs/abcd/raw", + }, +] +`; + +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 2`] = ` Object { "body": "- Removing markup from a part of the French translation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1878> - Fix typo documentation -> documentation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1880> @@ -518,32 +601,42 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 1`] = ` Array [ Object { "headers": Object { - "accept": "application/json", + "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate", - "host": "api.gitlab.com", + "host": "api.github.com", "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.gitlab.com/projects/gitlab-org/gitter/webapp/repository/tree/", + "url": "https://api.github.com/repos/facebook/jest", }, Object { "headers": Object { - "accept": "application/json", + "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate", - "host": "api.gitlab.com", + "host": "api.github.com", "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.gitlab.com/projects/gitlab-org/gitter/webapp/repository/files/CHANGELOG.md?ref=master", + "url": "https://api.github.com/repos/facebook/jest/git/trees/master", + }, + Object { + "headers": Object { + "accept": "application/vnd.github.v3+json", + "accept-encoding": "gzip, deflate", + "host": "api.github.com", + "user-agent": "https://github.com/renovatebot/renovate", + }, + "method": "GET", + "url": "https://api.github.com/repos/facebook/jest/git/blobs/abcd", }, ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 2`] = ` Object { "body": "##### Fixes @@ -735,7 +828,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 1`] = ` Array [ Object { "headers": Object { @@ -745,32 +838,8 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/facebook/jest/contents/", - }, - Object { - "headers": Object { - "accept": "application/vnd.github.v3+json", - "accept-encoding": "gzip, deflate", - "host": "api.github.com", - "user-agent": "https://github.com/renovatebot/renovate", - }, - "method": "GET", - "url": "https://api.github.com/repos/facebook/jest/contents/CHANGELOG.md", + "url": "https://api.github.com/repos/nodeca/js-yaml", }, -] -`; - -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 1`] = ` -Object { - "body": "- Fix \`condenseFlow\` output (quote keys for sure, instead of spaces), [#371](https://github.com/nodeca/js-yaml/issues/371), [#370](https://github.com/nodeca/js-yaml/issues/370). -- Dump astrals as codepoints instead of surrogate pair, [#368](https://github.com/nodeca/js-yaml/issues/368). -", - "url": "https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md#3100--2017-09-10", -} -`; - -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 2`] = ` -Array [ Object { "headers": Object { "accept": "application/vnd.github.v3+json", @@ -779,7 +848,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/nodeca/js-yaml/contents/", + "url": "https://api.github.com/repos/nodeca/js-yaml/git/trees/master", }, Object { "headers": Object { @@ -789,7 +858,16 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/nodeca/js-yaml/contents/CHANGELOG.md", + "url": "https://api.github.com/repos/nodeca/js-yaml/git/blobs/abcd", }, ] `; + +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 2`] = ` +Object { + "body": "- Fix \`condenseFlow\` output (quote keys for sure, instead of spaces), [#371](https://github.com/nodeca/js-yaml/issues/371), [#370](https://github.com/nodeca/js-yaml/issues/370). +- Dump astrals as codepoints instead of surrogate pair, [#368](https://github.com/nodeca/js-yaml/issues/368). +", + "url": "https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md#3100--2017-09-10", +} +`; diff --git a/lib/workers/pr/changelog/github/index.ts b/lib/workers/pr/changelog/github/index.ts index b24bcc61b6c4607e520e72a04c8d72f8c79df5a1..6df23eb85f6ef8b7cbe7d4e9a8906244af1fb462 100644 --- a/lib/workers/pr/changelog/github/index.ts +++ b/lib/workers/pr/changelog/github/index.ts @@ -1,6 +1,9 @@ import changelogFilenameRegex from 'changelog-filename-regex'; import { logger } from '../../../../logger'; -import { GithubGitBlob } from '../../../../types/platform/github'; +import { + GithubGitBlob, + GithubGitTree, +} from '../../../../types/platform/github'; import { GithubHttp } from '../../../../util/http/github'; import { ensureTrailingSlash } from '../../../../util/url'; import { ChangeLogFile, ChangeLogNotes } from '../common'; @@ -43,16 +46,29 @@ export async function getReleaseNotesMd( ): Promise<ChangeLogFile> | null { logger.trace('github.getReleaseNotesMd()'); const apiPrefix = `${ensureTrailingSlash(apiBaseUrl)}repos/${repository}`; + const { default_branch = 'master' } = ( + await http.getJson<{ default_branch: string }>(apiPrefix) + ).body; - const res = await http.getJson<{ name: string }[]>(`${apiPrefix}/contents/`); + // https://docs.github.com/en/rest/reference/git#get-a-tree + const res = await http.getJson<GithubGitTree>( + `${apiPrefix}/git/trees/${default_branch}` + ); + + // istanbul ignore if + if (res.body.truncated) { + logger.debug({ repository }, 'Git tree truncated'); + } - const files = res.body.filter((f) => changelogFilenameRegex.test(f.name)); + const files = res.body.tree + .filter((f) => f.type === 'blob') + .filter((f) => changelogFilenameRegex.test(f.path)); if (!files.length) { logger.trace('no changelog file found'); return null; } - const { name: changelogFile } = files.shift(); + const { path: changelogFile, sha } = files.shift(); /* istanbul ignore if */ if (files.length > 1) { logger.debug( @@ -60,8 +76,9 @@ export async function getReleaseNotesMd( ); } + // https://docs.github.com/en/rest/reference/git#get-a-blob const fileRes = await http.getJson<GithubGitBlob>( - `${apiPrefix}/contents/${changelogFile}` + `${apiPrefix}/git/blobs/${sha}` ); const changelogMd = @@ -85,7 +102,7 @@ export async function getReleaseList( name: string; body: string; }[] - >(url); + >(url, { paginate: true }); return res.body.map((release) => ({ url: release.html_url, id: release.id, diff --git a/lib/workers/pr/changelog/gitlab.spec.ts b/lib/workers/pr/changelog/gitlab.spec.ts index 057f463087404d09978b723fe2b4e1740bc6b927..f5f89ce53211b77731e397355371a944534100e4 100644 --- a/lib/workers/pr/changelog/gitlab.spec.ts +++ b/lib/workers/pr/changelog/gitlab.spec.ts @@ -84,7 +84,7 @@ describe(getName(__filename), () => { it('uses GitLab tags', async () => { httpMock .scope(baseUrl) - .get('/api/v4/projects/meno%2fdropzone/repository/tags') + .get('/api/v4/projects/meno%2fdropzone/repository/tags?per_page=100') .reply(200, [ { name: 'v5.2.0' }, { name: 'v5.4.0' }, @@ -94,7 +94,7 @@ describe(getName(__filename), () => { { name: 'v5.7.0' }, ]) .persist() - .get('/api/v4/projects/meno/dropzone/repository/tree/') + .get('/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100') .reply(200, []) .persist() .get('/api/v4/projects/meno%2fdropzone/releases?per_page=100') @@ -109,10 +109,10 @@ describe(getName(__filename), () => { it('handles empty GitLab tags response', async () => { httpMock .scope(baseUrl) - .get('/api/v4/projects/meno%2fdropzone/repository/tags') + .get('/api/v4/projects/meno%2fdropzone/repository/tags?per_page=100') .reply(200, []) .persist() - .get('/api/v4/projects/meno/dropzone/repository/tree/') + .get('/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100') .reply(200, []) .persist() .get('/api/v4/projects/meno%2fdropzone/releases?per_page=100') @@ -127,10 +127,10 @@ describe(getName(__filename), () => { it('uses GitLab tags with error', async () => { httpMock .scope(baseUrl) - .get('/api/v4/projects/meno%2fdropzone/repository/tags') + .get('/api/v4/projects/meno%2fdropzone/repository/tags?per_page=100') .replyWithError('Unknown GitLab Repo') .persist() - .get('/api/v4/projects/meno/dropzone/repository/tree/') + .get('/api/v4/projects/meno%2fdropzone/repository/tree?per_page=100') .reply(200, []) .persist() .get('/api/v4/projects/meno%2fdropzone/releases?per_page=100') diff --git a/lib/workers/pr/changelog/gitlab/index.ts b/lib/workers/pr/changelog/gitlab/index.ts index ddf9a644bfe0b940fa372f7845a6586c2fc4f6bc..dd343e81d5994c200a5dc972ab5c083b5a3e5071 100644 --- a/lib/workers/pr/changelog/gitlab/index.ts +++ b/lib/workers/pr/changelog/gitlab/index.ts @@ -18,9 +18,11 @@ export async function getTags( logger.trace('gitlab.getTags()'); const url = `${ensureTrailingSlash(endpoint)}projects/${getRepoId( repository - )}/repository/tags`; + )}/repository/tags?per_page=100`; try { - const res = await http.getJson<{ name: string }[]>(url); + const res = await http.getJson<{ name: string }[]>(url, { + paginate: true, + }); const tags = res.body; @@ -45,19 +47,26 @@ export async function getReleaseNotesMd( apiBaseUrl: string ): Promise<ChangeLogFile> | null { logger.trace('gitlab.getReleaseNotesMd()'); + const repoid = getRepoId(repository); const apiPrefix = `${ensureTrailingSlash( apiBaseUrl - )}projects/${repository}/repository/`; + )}projects/${repoid}/repository/`; // https://docs.gitlab.com/13.2/ee/api/repositories.html#list-repository-tree - let files = (await http.getJson<GitlabTreeNode[]>(`${apiPrefix}tree/`)).body; + let files = ( + await http.getJson<GitlabTreeNode[]>(`${apiPrefix}tree?per_page=100`, { + paginate: true, + }) + ).body; - files = files.filter((f) => changelogFilenameRegex.test(f.name)); + files = files + .filter((f) => f.type === 'blob') + .filter((f) => changelogFilenameRegex.test(f.path)); if (!files.length) { logger.trace('no changelog file found'); return null; } - const { name: changelogFile } = files.shift(); + const { path: changelogFile, id } = files.shift(); /* istanbul ignore if */ if (files.length > 1) { logger.debug( @@ -65,11 +74,9 @@ export async function getReleaseNotesMd( ); } - const fileRes = await http.getJson<{ content: string }>( - `${apiPrefix}files/${changelogFile}?ref=master` - ); - const changelogMd = - Buffer.from(fileRes.body.content, 'base64').toString() + '\n#\n##'; + // https://docs.gitlab.com/13.2/ee/api/repositories.html#raw-blob-content + const fileRes = await http.get(`${apiPrefix}blobs/${id}/raw`); + const changelogMd = fileRes.body + '\n#\n##'; return { changelogFile, changelogMd }; } diff --git a/lib/workers/pr/changelog/index.spec.ts b/lib/workers/pr/changelog/index.spec.ts index d7d9071fe60315552579c6fddaff7085b8ab9726..074e0afc7f62af17a79d24182ec9c4f6ce77591c 100644 --- a/lib/workers/pr/changelog/index.spec.ts +++ b/lib/workers/pr/changelog/index.spec.ts @@ -91,13 +91,13 @@ describe(getName(__filename), () => { it('works without Github', async () => { httpMock .scope(githubApiHost) + .get('/repos/chalk/chalk') + .times(4) + .reply(500) .get('/repos/chalk/chalk/tags?per_page=100') .reply(500) .get('/repos/chalk/chalk/releases?per_page=100') .times(4) - .reply(500) - .get('/repos/chalk/chalk/contents/') - .times(4) .reply(500); expect( await getChangeLogJSON({ diff --git a/lib/workers/pr/changelog/release-notes.spec.ts b/lib/workers/pr/changelog/release-notes.spec.ts index b5d6ff881b602e1286cfcff535f4c4637fff40e5..ef1b7320e0ba136b8126cac0fdb648181e89bfdf 100644 --- a/lib/workers/pr/changelog/release-notes.spec.ts +++ b/lib/workers/pr/changelog/release-notes.spec.ts @@ -38,10 +38,18 @@ const gitterWebappChangelogMd = fs.readFileSync( 'utf8' ); -const contentsResponse = [ - { name: 'lib' }, - { name: 'CHANGELOG.md' }, - { name: 'README.md' }, +const githubTreeResponse = { + tree: [ + { path: 'lib', type: 'tree' }, + { path: 'CHANGELOG.md', type: 'blob', sha: 'abcd' }, + { path: 'README.md', type: 'blob' }, + ], +}; + +const gitlabTreeResponse = [ + { path: 'lib', type: 'tree' }, + { path: 'CHANGELOG.md', type: 'blob', id: 'abcd' }, + { path: 'README.md', type: 'blob' }, ]; describe(getName(__filename), () => { @@ -216,8 +224,15 @@ describe(getName(__filename), () => { it('handles files mismatch', async () => { httpMock .scope('https://api.github.com') - .get('/repos/chalk/contents/') - .reply(200, [{ name: 'lib' }, { name: 'README.md' }]); + .get('/repos/chalk') + .reply(200) + .get('/repos/chalk/git/trees/master') + .reply(200, { + tree: [ + { name: 'lib', type: 'tree' }, + { name: 'README.md', type: 'blob' }, + ], + }); const res = await getReleaseNotesMd( 'chalk', '2.0.0', @@ -230,9 +245,11 @@ describe(getName(__filename), () => { it('handles wrong format', async () => { httpMock .scope('https://api.github.com') - .get('/repos/some/repository1/contents/') - .reply(200, contentsResponse) - .get('/repos/some/repository1/contents/CHANGELOG.md') + .get('/repos/some/repository1') + .reply(200) + .get('/repos/some/repository1/git/trees/master') + .reply(200, githubTreeResponse) + .get('/repos/some/repository1/git/blobs/abcd') .reply(200, { content: Buffer.from('not really markdown').toString('base64'), }); @@ -248,9 +265,11 @@ describe(getName(__filename), () => { it('handles bad markdown', async () => { httpMock .scope('https://api.github.com') - .get('/repos/some/repository2/contents/') - .reply(200, contentsResponse) - .get('/repos/some/repository2/contents/CHANGELOG.md') + .get('/repos/some/repository2') + .reply(200) + .get('/repos/some/repository2/git/trees/master') + .reply(200, githubTreeResponse) + .get('/repos/some/repository2/git/blobs/abcd') .reply(200, { content: Buffer.from(`#\nha\nha\n#\nha\nha`).toString('base64'), }); @@ -266,9 +285,11 @@ describe(getName(__filename), () => { it('parses angular.js', async () => { httpMock .scope('https://api.github.com') - .get('/repos/angular/angular.js/contents/') - .reply(200, contentsResponse) - .get('/repos/angular/angular.js/contents/CHANGELOG.md') + .get('/repos/angular/angular.js') + .reply(200) + .get('/repos/angular/angular.js/git/trees/master') + .reply(200, githubTreeResponse) + .get('/repos/angular/angular.js/git/blobs/abcd') .reply(200, { content: Buffer.from(angularJsChangelogMd).toString('base64'), }); @@ -283,32 +304,33 @@ describe(getName(__filename), () => { expect(httpMock.getTrace()).toMatchSnapshot(); }); it('parses gitlab.com/gitlab-org/gitter/webapp', async () => { + jest.setTimeout(0); httpMock .scope('https://api.gitlab.com/') - .get('/projects/gitlab-org/gitter/webapp/repository/tree/') - .reply(200, contentsResponse) .get( - '/projects/gitlab-org/gitter/webapp/repository/files/CHANGELOG.md?ref=master' + '/projects/gitlab-org%2fgitter%2fwebapp/repository/tree?per_page=100' ) - .reply(200, { - content: Buffer.from(gitterWebappChangelogMd).toString('base64'), - }); + .reply(200, gitlabTreeResponse) + .get('/projects/gitlab-org%2fgitter%2fwebapp/repository/blobs/abcd/raw') + .reply(200, gitterWebappChangelogMd); const res = await getReleaseNotesMd( 'gitlab-org/gitter/webapp', '20.26.0', 'https://gitlab.com/', 'https://api.gitlab.com/' ); + expect(httpMock.getTrace()).toMatchSnapshot(); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); - expect(httpMock.getTrace()).toMatchSnapshot(); }); it('parses jest', async () => { httpMock .scope('https://api.github.com') - .get('/repos/facebook/jest/contents/') - .reply(200, contentsResponse) - .get('/repos/facebook/jest/contents/CHANGELOG.md') + .get('/repos/facebook/jest') + .reply(200) + .get('/repos/facebook/jest/git/trees/master') + .reply(200, githubTreeResponse) + .get('/repos/facebook/jest/git/blobs/abcd') .reply(200, { content: Buffer.from(jestChangelogMd).toString('base64'), }); @@ -318,16 +340,18 @@ describe(getName(__filename), () => { 'https://github.com/', 'https://api.github.com/' ); + expect(httpMock.getTrace()).toMatchSnapshot(); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); - expect(httpMock.getTrace()).toMatchSnapshot(); }); it('parses js-yaml', async () => { httpMock .scope('https://api.github.com') - .get('/repos/nodeca/js-yaml/contents/') - .reply(200, contentsResponse) - .get('/repos/nodeca/js-yaml/contents/CHANGELOG.md') + .get('/repos/nodeca/js-yaml') + .reply(200) + .get('/repos/nodeca/js-yaml/git/trees/master') + .reply(200, githubTreeResponse) + .get('/repos/nodeca/js-yaml/git/blobs/abcd') .reply(200, { content: Buffer.from(jsYamlChangelogMd).toString('base64'), }); @@ -337,9 +361,9 @@ describe(getName(__filename), () => { 'https://github.com/', 'https://api.github.com/' ); + expect(httpMock.getTrace()).toMatchSnapshot(); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); - expect(httpMock.getTrace()).toMatchSnapshot(); }); describe('ReleaseNotes Correctness', () => { let versionOneNotes: ChangeLogNotes; @@ -347,9 +371,11 @@ describe(getName(__filename), () => { it('parses yargs 15.3.0', async () => { httpMock .scope('https://api.github.com') - .get('/repos/yargs/yargs/contents/') - .reply(200, contentsResponse) - .get('/repos/yargs/yargs/contents/CHANGELOG.md') + .get('/repos/yargs/yargs') + .reply(200, { default_branch: 'main' }) + .get('/repos/yargs/yargs/git/trees/main') + .reply(200, githubTreeResponse) + .get('/repos/yargs/yargs/git/blobs/abcd') .reply(200, { content: Buffer.from(yargsChangelogMd).toString('base64'), }); @@ -360,16 +386,18 @@ describe(getName(__filename), () => { 'https://api.github.com/' ); versionOneNotes = res; + expect(httpMock.getTrace()).toMatchSnapshot(); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); - expect(httpMock.getTrace()).toMatchSnapshot(); }); it('parses yargs 15.2.0', async () => { httpMock .scope('https://api.github.com') - .get('/repos/yargs/yargs/contents/') - .reply(200, contentsResponse) - .get('/repos/yargs/yargs/contents/CHANGELOG.md') + .get('/repos/yargs/yargs') + .reply(200, { default_branch: 'main' }) + .get('/repos/yargs/yargs/git/trees/main') + .reply(200, githubTreeResponse) + .get('/repos/yargs/yargs/git/blobs/abcd') .reply(200, { content: Buffer.from(yargsChangelogMd).toString('base64'), }); @@ -380,23 +408,21 @@ describe(getName(__filename), () => { 'https://api.github.com/' ); versionTwoNotes = res; + expect(httpMock.getTrace()).toMatchSnapshot(); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); - expect(httpMock.getTrace()).toMatchSnapshot(); }); it('parses adapter-utils 4.33.0', async () => { httpMock .scope('https://gitlab.com/') .get( - '/api/v4/projects/itentialopensource/adapter-utils/repository/tree/' + '/api/v4/projects/itentialopensource%2fadapter-utils/repository/tree?per_page=100' ) - .reply(200, contentsResponse) + .reply(200, gitlabTreeResponse) .get( - '/api/v4/projects/itentialopensource/adapter-utils/repository/files/CHANGELOG.md?ref=master' + '/api/v4/projects/itentialopensource%2fadapter-utils/repository/blobs/abcd/raw' ) - .reply(200, { - content: Buffer.from(adapterutilsChangelogMd).toString('base64'), - }); + .reply(200, adapterutilsChangelogMd); const res = await getReleaseNotesMd( 'itentialopensource/adapter-utils', '4.33.0', @@ -404,9 +430,9 @@ describe(getName(__filename), () => { 'https://gitlab.com/api/v4/' ); versionTwoNotes = res; + expect(httpMock.getTrace()).toMatchSnapshot(); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); - expect(httpMock.getTrace()).toMatchSnapshot(); }); it('isUrl', () => { expect(versionOneNotes).not.toMatchObject(versionTwoNotes);