diff --git a/lib/workers/repository/update/pr/changelog/__snapshots__/github.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/github.spec.ts.snap index 57f6a7c9133b97df3c1bd188fd6753111509cdd9..0fd0d55de47a557c2eb37c4423aeab6225273499 100644 --- a/lib/workers/repository/update/pr/changelog/__snapshots__/github.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/github.spec.ts.snap @@ -17,6 +17,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -24,6 +25,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -33,6 +35,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -45,6 +48,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -72,6 +76,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -79,6 +84,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -88,6 +94,7 @@ Object { "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -100,6 +107,7 @@ Object { "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -127,6 +135,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -134,6 +143,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -143,6 +153,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -155,6 +166,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -182,6 +194,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -189,6 +202,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -198,6 +212,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -210,6 +225,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -237,6 +253,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -244,6 +261,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -253,6 +271,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -265,6 +284,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -292,6 +312,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -299,6 +320,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -308,6 +330,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -320,6 +343,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", diff --git a/lib/workers/repository/update/pr/changelog/__snapshots__/gitlab.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/gitlab.spec.ts.snap index 5ea9435c491909c50081f5a2438f193f74cd0ff2..6fac4360721bc969becea26fdf364d50933d92fb 100644 --- a/lib/workers/repository/update/pr/changelog/__snapshots__/gitlab.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/gitlab.spec.ts.snap @@ -17,6 +17,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "5.6.1", }, @@ -24,6 +25,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2020-02-13T15:37:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.6.0", }, @@ -31,6 +33,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": "eba303e91c930292198b2fc57040145682162a1b", "releaseNotes": null, "version": "5.5.0", }, @@ -38,6 +41,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2018-08-24T14:23:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.4.0", }, @@ -62,6 +66,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "5.6.1", }, @@ -69,6 +74,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2020-02-13T15:37:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.6.0", }, @@ -76,6 +82,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": "eba303e91c930292198b2fc57040145682162a1b", "releaseNotes": null, "version": "5.5.0", }, @@ -83,6 +90,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2018-08-24T14:23:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.4.0", }, @@ -107,6 +115,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "5.6.1", }, @@ -114,6 +123,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2020-02-13T15:37:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.6.0", }, @@ -121,6 +131,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": "eba303e91c930292198b2fc57040145682162a1b", "releaseNotes": null, "version": "5.5.0", }, @@ -128,6 +139,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2018-08-24T14:23:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.4.0", }, @@ -154,6 +166,7 @@ Object { "url": "https://gitlab.com/meno/dropzone/compare/v5.6.0...v5.6.1", }, "date": undefined, + "gitRef": undefined, "releaseNotes": Object { "notesSourceUrl": "", "url": "https://gitlab.com/meno/dropzone/compare/v5.6.0...v5.6.1", @@ -166,6 +179,7 @@ Object { "url": "https://gitlab.com/meno/dropzone/compare/v5.5.0...v5.6.0", }, "date": "2020-02-13T15:37:00.000Z", + "gitRef": undefined, "releaseNotes": Object { "notesSourceUrl": "", "url": "https://gitlab.com/meno/dropzone/compare/v5.5.0...v5.6.0", @@ -178,6 +192,7 @@ Object { "url": "https://gitlab.com/meno/dropzone/compare/v5.4.0...v5.5.0", }, "date": undefined, + "gitRef": "eba303e91c930292198b2fc57040145682162a1b", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://gitlab.com/meno/dropzone/compare/v5.4.0...v5.5.0", @@ -190,6 +205,7 @@ Object { "url": "https://gitlab.com/meno/dropzone/compare/v5.2.0...v5.4.0", }, "date": "2018-08-24T14:23:00.000Z", + "gitRef": undefined, "releaseNotes": Object { "notesSourceUrl": "", "url": "https://gitlab.com/meno/dropzone/compare/v5.2.0...v5.4.0", @@ -217,6 +233,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "5.6.1", }, @@ -224,6 +241,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2020-02-13T15:37:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.6.0", }, @@ -231,6 +249,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": "eba303e91c930292198b2fc57040145682162a1b", "releaseNotes": null, "version": "5.5.0", }, @@ -238,6 +257,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2018-08-24T14:23:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.4.0", }, @@ -262,6 +282,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "5.6.1", }, @@ -269,6 +290,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2020-02-13T15:37:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.6.0", }, @@ -276,6 +298,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": "eba303e91c930292198b2fc57040145682162a1b", "releaseNotes": null, "version": "5.5.0", }, @@ -283,6 +306,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2018-08-24T14:23:00.000Z", + "gitRef": undefined, "releaseNotes": null, "version": "5.4.0", }, diff --git a/lib/workers/repository/update/pr/changelog/__snapshots__/index.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/index.spec.ts.snap index 7fe27ef13f2b02ca6140f8ac2e5f78604555525c..0bc6c5831b15a0bb1c8040de5060de49b3fa4eaf 100644 --- a/lib/workers/repository/update/pr/changelog/__snapshots__/index.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/index.spec.ts.snap @@ -17,6 +17,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -24,6 +25,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -33,6 +35,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -45,6 +48,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -72,6 +76,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -79,6 +84,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -88,6 +94,7 @@ Object { "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -100,6 +107,7 @@ Object { "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -127,6 +135,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -134,6 +143,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -143,6 +153,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -155,6 +166,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -182,6 +194,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -189,6 +202,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -198,6 +212,7 @@ Object { "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -210,6 +225,7 @@ Object { "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -237,6 +253,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -244,6 +261,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -253,6 +271,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -265,6 +284,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", @@ -292,6 +312,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -301,6 +322,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/v2.3.0...v2.4.2", }, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/v2.3.0...v2.4.2", @@ -313,6 +335,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/2.2.2...v2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/2.2.2...v2.3.0", @@ -325,6 +348,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/1.0.0...2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/1.0.0...2.2.2", @@ -352,6 +376,7 @@ Object { "changes": Array [], "compare": Object {}, "date": undefined, + "gitRef": undefined, "releaseNotes": null, "version": "2.5.2", }, @@ -359,6 +384,7 @@ Object { "changes": Array [], "compare": Object {}, "date": "2017-12-24T03:20:46.238Z", + "gitRef": undefined, "releaseNotes": null, "version": "2.4.2", }, @@ -368,6 +394,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", }, "date": "2017-10-24T03:20:46.238Z", + "gitRef": "npm_2.3.0", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0", @@ -380,6 +407,7 @@ Object { "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", }, "date": undefined, + "gitRef": "npm_2.2.2", "releaseNotes": Object { "notesSourceUrl": "", "url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2", diff --git a/lib/workers/repository/update/pr/changelog/release-notes.spec.ts b/lib/workers/repository/update/pr/changelog/release-notes.spec.ts index aa94a95e66515eccbade0bdbe43949226c42e888..226cfb3dd6c792c18ccf009d38b3e7cee55ed941 100644 --- a/lib/workers/repository/update/pr/changelog/release-notes.spec.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.spec.ts @@ -277,7 +277,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'some/repository', depName: 'some', }, - '1.0.0' + { + version: '1.0.0', + gitRef: '1.0.0', + } as ChangeLogRelease ); expect(res).toBeNull(); }); @@ -297,7 +300,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'some/other-repository', depName: 'other', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124)\n', @@ -325,7 +331,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'some/other-repository', depName: 'other', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124)\n', @@ -354,7 +363,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'some/other-repository', depName: 'other', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124)\n', @@ -383,7 +395,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'some/other-repository', depName: 'other', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124)\n', @@ -411,7 +426,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'some/other-repository', depName: 'other', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124)\n', @@ -445,7 +463,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { depName: 'other', apiBaseUrl: 'https://api.gitlab.com/', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body #123, [#124](https://gitlab.com/some/yet-other-repository/issues/124)', @@ -478,7 +499,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { depName: 'other', apiBaseUrl: 'https://api.gitlab.com/', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body #123, [#124](https://gitlab.com/some/yet-other-repository/issues/124)', @@ -511,7 +535,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { depName: 'other', apiBaseUrl: 'https://api.gitlab.com/', }, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toEqual({ body: 'some body #123, [#124](https://gitlab.com/some/yet-other-repository/issues/124)', @@ -531,7 +558,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { apiBaseUrl: 'https://api.lol.lol/', baseUrl: 'https://lol.lol/', } as ChangeLogProject, - '1.0.1' + { + version: '1.0.1', + gitRef: '1.0.1', + } as ChangeLogRelease ); expect(res).toBeNull(); }); @@ -555,7 +585,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'some/other-repository', depName: 'exampleDep', }, - '1.0.0' + { + version: '1.0.0', + gitRef: '1.0.0', + } as ChangeLogRelease ); expect(res).toEqual({ url: 'correct/url/tag.com', @@ -577,7 +610,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'chalk', }, - '2.0.0' + { + version: '2.0.0', + gitRef: '2.0.0', + } as ChangeLogRelease ); expect(res).toBeNull(); }); @@ -599,7 +635,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'chalk', }, - '2.0.0' + { + version: '2.0.0', + gitRef: '2.0.0', + } as ChangeLogRelease ); expect(res).toBeNull(); }); @@ -620,7 +659,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'some/repository1', }, - '1.0.0' + { + version: '1.0.0', + gitRef: '1.0.0', + } as ChangeLogRelease ); expect(res).toBeNull(); }); @@ -641,7 +683,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'some/repository2', }, - '1.0.0' + { + version: '1.0.0', + gitRef: '1.0.0', + } as ChangeLogRelease ); expect(res).toBeNull(); }); @@ -662,7 +707,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'angular/angular.js', }, - '1.6.9' + { + version: '1.6.9', + gitRef: '1.6.9', + } as ChangeLogRelease ); expect(res).toMatchSnapshot({ notesSourceUrl: @@ -687,7 +735,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'gitlab-org/gitter/webapp', apiBaseUrl: 'https://api.gitlab.com/', }, - '20.26.0' + { + version: '20.26.0', + gitRef: '20.26.0', + } as ChangeLogRelease ); expect(res).toMatchSnapshot({ @@ -715,7 +766,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { apiBaseUrl: 'https://my.custom.domain/', baseUrl: 'https://my.custom.domain/', }, - '20.26.0' + { + version: '20.26.0', + gitRef: '20.26.0', + } as ChangeLogRelease ); expect(res).toMatchSnapshot({ @@ -741,7 +795,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'facebook/jest', }, - '22.0.0' + { + version: '22.0.0', + gitRef: '22.0.0', + } as ChangeLogRelease ); expect(res).toMatchSnapshot({ @@ -773,7 +830,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'nodeca/js-yaml', sourceDirectory, }, - '3.10.0' + { + version: '3.10.0', + gitRef: '3.10.0', + } as ChangeLogRelease ); expect(res).toMatchSnapshot({ @@ -799,7 +859,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'nodeca/js-yaml', }, - '3.10.0' + { + version: '3.10.0', + gitRef: '3.10.0', + } as ChangeLogRelease ); expect(res).toMatchSnapshot({ @@ -814,7 +877,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { { repository: 'nodeca/js-yaml', } as ChangeLogProject, - '3.10.0' + { + version: '3.10.0', + gitRef: '3.10.0', + } as ChangeLogRelease ); expect(res).toBeNull(); }); @@ -839,7 +905,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'yargs/yargs', }, - '15.3.0' + { + version: '15.3.0', + gitRef: '15.3.0', + } as ChangeLogRelease ); versionOneNotes = res; @@ -866,7 +935,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...githubProject, repository: 'yargs/yargs', }, - '15.2.0' + { + version: '15.2.0', + gitRef: '15.2.0', + } as ChangeLogRelease ); versionTwoNotes = res; @@ -893,7 +965,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { ...gitlabProject, repository: 'itentialopensource/adapter-utils', }, - '4.33.0' + { + version: '4.33.0', + gitRef: '4.33.0', + } as ChangeLogRelease ); versionTwoNotes = res; @@ -926,7 +1001,10 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { repository: 'itentialopensource/adapter-utils', sourceDirectory, }, - '4.33.0' + { + version: '4.33.0', + gitRef: '4.33.0', + } as ChangeLogRelease ); versionTwoNotes = res; diff --git a/lib/workers/repository/update/pr/changelog/release-notes.ts b/lib/workers/repository/update/pr/changelog/release-notes.ts index 1709d6cf0424c2cca67b731a9e9f648cc15c1f71..616f4f63161b3d07b133d3b8775c7160bfdf22fa 100644 --- a/lib/workers/repository/update/pr/changelog/release-notes.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.ts @@ -13,6 +13,7 @@ import type { ChangeLogFile, ChangeLogNotes, ChangeLogProject, + ChangeLogRelease, ChangeLogResult, } from './types'; @@ -95,9 +96,10 @@ export function massageBody( export async function getReleaseNotes( project: ChangeLogProject, - version: string + release: ChangeLogRelease ): Promise<ChangeLogNotes | null> { const { depName, repository } = project; + const { version, gitRef } = release; logger.trace(`getReleaseNotes(${repository}, ${version}, ${depName})`); const releases = await getCachedReleaseList(project); logger.trace({ releases }, 'Release list from getReleaseList'); @@ -107,7 +109,11 @@ export async function getReleaseNotes( if (is.undefined(matchedRelease)) { // no exact match of a release then check other cases matchedRelease = releases.find( - (r) => r.tag === version || r.tag === `v${version}` + (r) => + r.tag === version || + r.tag === `v${version}` || + r.tag === gitRef || + r.tag === `v${gitRef}` ); } releaseNotes = await releaseNotesResult(matchedRelease, project); @@ -256,9 +262,10 @@ export function getReleaseNotesMdFile( export async function getReleaseNotesMd( project: ChangeLogProject, - version: string + release: ChangeLogRelease ): Promise<ChangeLogNotes | null> { const { baseUrl, repository } = project; + const version = release.version; logger.trace(`getReleaseNotesMd(${repository}, ${version})`); const skippedRepos = ['facebook/react-native']; // istanbul ignore if @@ -373,10 +380,10 @@ export async function addReleaseNotes( releaseNotes = await packageCache.get(cacheNamespace, cacheKey); // istanbul ignore else: no cache tests if (!releaseNotes) { - releaseNotes = await getReleaseNotesMd(input.project, v.version); + releaseNotes = await getReleaseNotesMd(input.project, v); // istanbul ignore else: should be tested if (!releaseNotes) { - releaseNotes = await getReleaseNotes(input.project, v.version); + releaseNotes = await getReleaseNotes(input.project, v); } // Small hack to force display of release notes when there is a compare url if (!releaseNotes && v.compare.url) { diff --git a/lib/workers/repository/update/pr/changelog/source-github.ts b/lib/workers/repository/update/pr/changelog/source-github.ts index 8d62b41dce635ac4451d24670000ff7cbe98753c..474ae3a46804c4ac56bde3689e03c3e4e157fd15 100644 --- a/lib/workers/repository/update/pr/changelog/source-github.ts +++ b/lib/workers/repository/update/pr/changelog/source-github.ts @@ -141,6 +141,7 @@ export async function getChangeLogJSON( if (!release) { release = { version: next.version, + gitRef: next.gitRef, date: next.releaseTimestamp, // put empty changes so that existing templates won't break changes: [], diff --git a/lib/workers/repository/update/pr/changelog/source-gitlab.ts b/lib/workers/repository/update/pr/changelog/source-gitlab.ts index 04815f531e264f881f829eee4087fb28fad4b0d9..679d7836a7eb1c046607cd8afdf8b2b1573fd66e 100644 --- a/lib/workers/repository/update/pr/changelog/source-gitlab.ts +++ b/lib/workers/repository/update/pr/changelog/source-gitlab.ts @@ -110,6 +110,7 @@ export async function getChangeLogJSON( release = { version: next.version, date: next.releaseTimestamp, + gitRef: next.gitRef, // put empty changes so that existing templates won't break changes: [], compare: {}, diff --git a/lib/workers/repository/update/pr/changelog/types.ts b/lib/workers/repository/update/pr/changelog/types.ts index ba737409d7d8abc319f180bce1d2b79026f4d439..a3184672a65301f7ba5eef05d77fb6c1365cc9b8 100644 --- a/lib/workers/repository/update/pr/changelog/types.ts +++ b/lib/workers/repository/update/pr/changelog/types.ts @@ -20,6 +20,7 @@ export interface ChangeLogRelease { date: string | Date; releaseNotes?: ChangeLogNotes; version: string; + gitRef: string; } export interface ChangeLogProject { diff --git a/lib/workers/repository/update/pr/index.spec.ts b/lib/workers/repository/update/pr/index.spec.ts index 345301637b4f3fc28504b4fed1fcf9f019646d3a..912284d7635d4290f84b90af7a98eb9abbd50aa4 100644 --- a/lib/workers/repository/update/pr/index.spec.ts +++ b/lib/workers/repository/update/pr/index.spec.ts @@ -566,6 +566,7 @@ describe('workers/repository/update/pr/index', () => { const dummyRelease: ChangeLogRelease = { version: '', + gitRef: '', changes: dummyChanges, compare: {}, date: '',