diff --git a/lib/workers/pr/__snapshots__/index.spec.ts.snap b/lib/workers/pr/__snapshots__/index.spec.ts.snap index f53d740c73e674..4765f6e7d44d75 100644 --- a/lib/workers/pr/__snapshots__/index.spec.ts.snap +++ b/lib/workers/pr/__snapshots__/index.spec.ts.snap @@ -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| e | | lockFileMaintenance | \`\` -> \`\` |\\n| f | | 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
\\nrenovateapp/dummy (dummy)\\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
\\n\\n
\\nrenovateapp/dummy (b)\\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
\\n\\n
\\nrenovateapp/dummymonorepo\\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
\\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 - [ ] 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| e | | lockFileMaintenance | \`\` -> \`\` |\\n| f | | lockFileMaintenance | \`\` -> \`\` |\\n| g | | lockFileMaintenance | \`\` -> \`\` |\\n| h | | 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
\\nrenovateapp/dummy (dummy)\\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
\\n\\n
\\nrenovateapp/dummy (b)\\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
\\n\\n
\\nrenovateapp/dummymonorepo\\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
\\n\\n
\\nrenovateapp/anotherdummymonorepo (g)\\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
\\n\\n
\\nrenovateapp/anotherdummymonorepo (h)\\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
\\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 - [ ] 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, diff --git a/lib/workers/pr/index.spec.ts b/lib/workers/pr/index.spec.ts index 5915de3808f4ae..27efa86b931827 100644 --- a/lib/workers/pr/index.spec.ts +++ b/lib/workers/pr/index.spec.ts @@ -291,6 +291,7 @@ describe('workers/pr/index', () => { }); it('should create group PR', async () => { const depsWithSameNotesSourceUrl = ['e', 'f']; + const depsWithSameSourceUrl = ['g', 'h']; config.upgrades = config.upgrades.concat([ { depName: 'a', @@ -324,6 +325,16 @@ describe('workers/pr/index', () => { updateType: 'lockFileMaintenance', prBodyNotes: ['{{#if foo}}'], }, + { + depName: depsWithSameSourceUrl[0], + updateType: 'lockFileMaintenance', + prBodyNotes: ['{{#if foo}}'], + }, + { + depName: depsWithSameSourceUrl[1], + updateType: 'lockFileMaintenance', + prBodyNotes: ['{{#if foo}}'], + }, ] as never); config.updateType = 'lockFileMaintenance'; config.recreateClosed = true; @@ -352,6 +363,27 @@ describe('workers/pr/index', () => { }), }; } + + if (depsWithSameSourceUrl.includes(upgrade.depName)) { + upgrade.sourceDirectory = `packages/${upgrade.depName}`; + + upgrade.logJSON = { + ...upgrade.logJSON, + project: { + ...upgrade.logJSON.project, + repository: 'renovateapp/anotherdummymonorepo', + }, + versions: upgrade.logJSON.versions.map((V) => { + return { + ...V, + releaseNotes: { + ...V.releaseNotes, + notesSourceUrl: null, + }, + }; + }), + }; + } } const { pr } = await prWorker.ensurePr(config); expect(pr).toMatchObject({ displayNumber: 'New Pull Request' }); diff --git a/lib/workers/pr/index.ts b/lib/workers/pr/index.ts index b84edac6aea0a7..869dc1e0fb0312 100644 --- a/lib/workers/pr/index.ts +++ b/lib/workers/pr/index.ts @@ -328,8 +328,12 @@ export async function ensurePr( const releaseNotesSources: string[] = []; for (const upgrade of config.upgrades) { - const notesSourceUrl = - upgrade.releases?.[0]?.releaseNotes?.notesSourceUrl || upgrade.sourceUrl; + let notesSourceUrl = upgrade.releases?.[0]?.releaseNotes?.notesSourceUrl; + if (!notesSourceUrl) { + notesSourceUrl = `${upgrade.sourceUrl}${ + upgrade.sourceDirectory ? `:${upgrade.sourceDirectory}` : '' + }`; + } if (upgrade.hasReleaseNotes && notesSourceUrl) { if (releaseNotesSources.includes(notesSourceUrl)) {