diff --git a/__snapshots__/manifest.js b/__snapshots__/manifest.js index f1d199196..764742965 100644 --- a/__snapshots__/manifest.js +++ b/__snapshots__/manifest.js @@ -93,7 +93,7 @@ exports['Manifest buildPullRequests should handle mixing componentless configs 1 --- -
1.0.1 +
pkg1: 1.0.1 ## [1.0.1](https://github.com/fake-owner/fake-repo/compare/v1.0.0...v1.0.1) (1983-10-10) diff --git a/docs/manifest-releaser.md b/docs/manifest-releaser.md index 102283e5e..9fdec02a4 100644 --- a/docs/manifest-releaser.md +++ b/docs/manifest-releaser.md @@ -517,7 +517,7 @@ Example: }, { "type": "linked-versions", - "group-name": "my group", + "groupName": "my group", "components": [ "pkgA", "pkgB" ] diff --git a/src/manifest.ts b/src/manifest.ts index a201cdb49..21bb69935 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -501,7 +501,8 @@ export class Manifest { continue; } const component = tagName.component || DEFAULT_COMPONENT_NAME; - const path = pathsByComponent[component]; + const path = + pathsByComponent[component] || this.#getComponentlessPackage(); if (!path) { this.logger.warn( `Found release tag with component '${component}', but not configured in manifest` @@ -747,6 +748,15 @@ export class Manifest { ); } + #getComponentlessPackage(): string { + for (const path in this.repositoryConfig) { + if (!this.repositoryConfig[path].includeComponentInTag) { + return path; + } + } + return ''; + } + private async backfillReleasesFromTags( missingPaths: string[], strategiesByPath: Record diff --git a/src/strategies/base.ts b/src/strategies/base.ts index 84d1fddc0..c0a426a2c 100644 --- a/src/strategies/base.ts +++ b/src/strategies/base.ts @@ -155,9 +155,6 @@ export abstract class BaseStrategy implements Strategy { * @returns {string} */ async getComponent(): Promise { - if (!this.includeComponentInTag) { - return ''; - } return this.component || (await this.getDefaultComponent()); } diff --git a/test/fixtures/release-notes/grouped.txt b/test/fixtures/release-notes/grouped.txt index 2b1aa21a0..0d8a5ade4 100644 --- a/test/fixtures/release-notes/grouped.txt +++ b/test/fixtures/release-notes/grouped.txt @@ -2,7 +2,7 @@ --- -
1.0.1 +
base: 1.0.1 ## [1.0.1](https://github.com/testOwner/testRepo/compare/v1.0.0...v1.0.1) (2022-07-16) diff --git a/test/fixtures/release-notes/mixed-componentless-manifest.txt b/test/fixtures/release-notes/mixed-componentless-manifest.txt index d47aed238..fa42e2486 100644 --- a/test/fixtures/release-notes/mixed-componentless-manifest.txt +++ b/test/fixtures/release-notes/mixed-componentless-manifest.txt @@ -1,6 +1,6 @@ :robot: I have created a release \*beep\* \*boop\* --- -
3.2.0 +
@google-automation/bot-config-utils: 3.2.0 ### Features diff --git a/test/util/pull-request-body.ts b/test/util/pull-request-body.ts index df4fd6ec2..7145e5737 100644 --- a/test/util/pull-request-body.ts +++ b/test/util/pull-request-body.ts @@ -63,7 +63,9 @@ describe('PullRequestBody', () => { expect(pullRequestBody).to.not.be.undefined; const releaseData = pullRequestBody!.releaseData; expect(releaseData).lengthOf(2); - expect(releaseData[0].component).to.be.undefined; + expect(releaseData[0].component).to.eq( + '@google-automation/bot-config-utils' + ); expect(releaseData[0].version?.toString()).to.eql('3.2.0'); expect(releaseData[0].notes).matches(/^### Features/); expect(releaseData[1].component).to.eql(