googleapis / googleapis/release-please

getDefaultComponent doesn't find the right packageName if includeComponentInTag is set to false and it is for a nested path

Open
#2,214 3 comments 1 reaction 1 assignee Claimed by @chingor13 View on GitHub
priority: p3 type: bug
Dominant language
TypeScript
Stars
7.5k
Forks
588
Avg merge
12h 16m
Merged PRs (30d)
7

Description

I was investigating why release-please did not open a PR here: https://github.com/googleapis/gax-nodejs/pull/1553

The CLI does not tag the PR with the warning:

⚠ PR component: undefined does not match configured component: google-gax
(here):

[release-please/src/strategies/base.ts](https://github.com/googleapis/release-please/blob/72b0ab360c3d6635397e8b02f4d3f9f53932e23c/src/strategies/base.ts#L615)

Line 615 in [72b0ab3](https://github.com/googleapis/release-please/commit/72b0ab360c3d6635397e8b02f4d3f9f53932e23c)

`PR component: ${branchName.component} does not match configured component: ${branchComponent}`
That is true, since the branch does not contain the component:
Screenshot 2024-02-01 at 1 44 57 AM

There's a bug that occurs when setting the branchName in `buildPullRequests` in manifest, it will return empty [here](https://github.com/googleapis/release-please/blob/72b0ab360c3d6635397e8b02f4d3f9f53932e23c/src/strategies/base.ts#L302)

I think that's because `getBranchComponent` returns an empty string here: https://github.com/googleapis/release-please/blob/72b0ab360c3d6635397e8b02f4d3f9f53932e23c/src/strategies/base.ts#L176 because [getDefaultComponent](https://github.com/googleapis/release-please/blob/72b0ab360c3d6635397e8b02f4d3f9f53932e23c/src/strategies/base.ts#L169) is not grabbing the packageName correctly for nested packages that have includeComponentInTag set to false (as in my [config](https://github.com/googleapis/gax-nodejs/blob/main/release-please-config.json))

A workaround I'll try in the meantime is just to specify it in the config object explicitly - that should work. But I think the better functionality is to automatically grab it from the nearest package.json

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.