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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: linked-versions + includeComponentInTag=false should work #1749

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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: 1 addition & 1 deletion __snapshots__/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ exports['Manifest buildPullRequests should handle mixing componentless configs 1
---


<details><summary>1.0.1</summary>
<details><summary>pkg1: 1.0.1</summary>

## [1.0.1](https://github.com/fake-owner/fake-repo/compare/v1.0.0...v1.0.1) (1983-10-10)

Expand Down
12 changes: 11 additions & 1 deletion src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,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`
Expand Down Expand Up @@ -797,6 +798,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<string, Strategy>
Expand Down
3 changes: 0 additions & 3 deletions src/strategies/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ export abstract class BaseStrategy implements Strategy {
* @returns {string}
*/
async getComponent(): Promise<string | undefined> {
if (!this.includeComponentInTag) {
return '';
}
return this.component || (await this.getDefaultComponent());
}

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/release-notes/grouped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---


<details><summary>1.0.1</summary>
<details><summary>base: 1.0.1</summary>

## [1.0.1](https://github.com/testOwner/testRepo/compare/v1.0.0...v1.0.1) (2022-07-16)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:robot: I have created a release \*beep\* \*boop\*
---
<details><summary>3.2.0</summary>
<details><summary>@google-automation/bot-config-utils: 3.2.0</summary>


### Features
Expand Down
4 changes: 3 additions & 1 deletion test/util/pull-request-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down