Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(release notes): Show release notes from monorepo #12543

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/datasource/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ChangeLogNotes } from '../workers/pr/changelog/types';
rarkins marked this conversation as resolved.
Show resolved Hide resolved
export interface Config {
datasource?: string;
depName?: string;
Expand Down Expand Up @@ -48,6 +49,7 @@ export interface Release {
registryUrl?: string;
sourceUrl?: string;
sourceDirectory?: string;
releaseNotes?: ChangeLogNotes;
rarkins marked this conversation as resolved.
Show resolved Hide resolved
}

export interface ReleaseResult {
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/pr/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Array [
"gitLabIgnoreApprovals": false,
"usePlatformAutomerge": false,
},
"prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | lockFileMaintenance | \`1.0.0\` -> \`1.1.0\` |\\n| a | | | \`zzzzzz\` -> \`aaaaaaa\` |\\n| b | | pin | \`some_old_value\` -> \`some_new_value\` |\\n| c | | | \`\` -> \`\` |\\n| d | | lockFileMaintenance | \`\` -> \`\` |\\n\\nnote 1\\n\\nnote 2\\n\\n:warning: Release Notes retrieval for this PR were skipped because no github.com credentials were available.\\nIf you are self-hosted, please see [this instruction](https://github.com/renovatebot/renovate/blob/master/docs/usage/examples/self-hosting.md#githubcom-token-for-release-notes).\\n\\n🔡 If you wish to disable git hash updates, add \`\\":disableDigestUpdates\\"\` to the extends array in your config.\\n\\n🔧 This Pull Request updates lock files to use the latest dependency versions.\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n</details>\\n\\n---\\n\\n### Configuration\\n\\n📅 **Schedule**: At any time (no schedule defined).\\n\\n🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\n♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.\\n\\n👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).",
"prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | lockFileMaintenance | \`1.0.0\` -> \`1.1.0\` |\\n| a | | | \`zzzzzz\` -> \`aaaaaaa\` |\\n| b | | pin | \`some_old_value\` -> \`some_new_value\` |\\n| c | | | \`\` -> \`\` |\\n| d | | lockFileMaintenance | \`\` -> \`\` |\\n\\nnote 1\\n\\nnote 2\\n\\n:warning: Release Notes retrieval for this PR were skipped because no github.com credentials were available.\\nIf you are self-hosted, please see [this instruction](https://github.com/renovatebot/renovate/blob/master/docs/usage/examples/self-hosting.md#githubcom-token-for-release-notes).\\n\\n🔡 If you wish to disable git hash updates, add \`\\":disableDigestUpdates\\"\` to the extends array in your config.\\n\\n🔧 This Pull Request updates lock files to use the latest dependency versions.\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy (dummy)</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n<details>\\n<summary>renovateapp/dummy (b)</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n<details>\\n<summary>renovateapp/dummy (c)</summary>\\n\\n</details>\\n\\n<details>\\n<summary>renovateapp/dummy (d)</summary>\\n\\n</details>\\n\\n---\\n\\n### Configuration\\n\\n📅 **Schedule**: At any time (no schedule defined).\\n\\n🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\n♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.\\n\\n👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).",
"prTitle": "Update dependency dummy to v1.1.0",
"sourceBranch": "renovate/dummy-1.x",
"targetBranch": undefined,
Expand Down
20 changes: 20 additions & 0 deletions lib/workers/pr/body/changelogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ export function getChangelogs(config: BranchConfig): string {
if (!config.hasReleaseNotes) {
return releaseNotes;
}

const countReleaseNodesByRepoName: Record<string, number> = {};

for (const upgrade of config.upgrades) {
if (upgrade.hasReleaseNotes) {
countReleaseNodesByRepoName[upgrade.repoName] =
(countReleaseNodesByRepoName[upgrade.repoName] || 0) + 1;
}
}

for (const upgrade of config.upgrades) {
if (upgrade.hasReleaseNotes) {
upgrade.releaseNotesSummaryTitle = `${upgrade.repoName}${
countReleaseNodesByRepoName[upgrade.repoName] > 1
? ` (${upgrade.depName})`
: ''
}`;
}
}

releaseNotes +=
'\n\n---\n\n' + template.compile(releaseNotesHbs, config, false) + '\n\n';
releaseNotes = releaseNotes.replace(regEx(/### \[`vv/g), '### [`v');
Expand Down
12 changes: 12 additions & 0 deletions lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -45,6 +46,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -87,6 +89,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -98,6 +101,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -140,6 +144,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -151,6 +156,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -193,6 +199,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -204,6 +211,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -246,6 +254,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -257,6 +266,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -299,6 +309,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -310,6 +321,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down
4 changes: 4 additions & 0 deletions lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://gitlab.com/meno/dropzone/compare/v5.6.0...v5.6.1",
},
"version": "5.6.1",
Expand All @@ -270,6 +271,7 @@ Object {
},
"date": "2020-02-13T15:37:00.000Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://gitlab.com/meno/dropzone/compare/v5.5.0...v5.6.0",
},
"version": "5.6.0",
Expand All @@ -281,6 +283,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://gitlab.com/meno/dropzone/compare/v5.4.0...v5.5.0",
},
"version": "5.5.0",
Expand All @@ -292,6 +295,7 @@ Object {
},
"date": "2018-08-24T14:23:00.000Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://gitlab.com/meno/dropzone/compare/v5.2.0...v5.4.0",
},
"version": "5.4.0",
Expand Down
15 changes: 15 additions & 0 deletions lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -45,6 +46,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -191,6 +193,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -202,6 +205,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -392,6 +396,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -403,6 +408,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -593,6 +599,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -604,6 +611,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -794,6 +802,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -805,6 +814,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -840,6 +850,7 @@ Object {
},
"date": "2017-12-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/v2.3.0...v2.4.2",
},
"version": "2.4.2",
Expand All @@ -851,6 +862,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/2.2.2...v2.3.0",
},
"version": "2.3.0",
Expand All @@ -862,6 +874,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/1.0.0...2.2.2",
},
"version": "2.2.2",
Expand Down Expand Up @@ -1052,6 +1065,7 @@ Object {
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
Expand All @@ -1063,6 +1077,7 @@ Object {
},
"date": undefined,
"releaseNotes": Object {
"notesSourceUrl": "",
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
Expand Down