Skip to content

Conversation

stan-stately
Copy link
Contributor

@stan-stately stan-stately commented May 8, 2025

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1921 #2167 #2466 #662 #1032 #1581 #2339 🦕

Hi. Just picking up @jack-lewin's work from here and addressing this specific comment:

This mostly looks fine although we should explicitly define what the expected logic is if an additional path coincides with a different component's path or additional paths. Currently, we sort by the components' path length with the longest first as a way to prefer the deepest path in the case of overlapping paths. With this new logic, we are still sorting based on the main path, and preferring its additional paths over any other ones.

Instead, we may need to invert the mapping and have the keys be all the "paths" (main & additional) and the value is the main component path to associate to.

I'm doing 2 passes of the incoming files:

  1. Assign commit to the first "primary" package name match when looping through all package names from longest to shortest
  • This means core/lib/file.txt triggers an update for core/lib not core
  • This is existing behavior and maintains backwards compat
  1. Assign to every package which matches a path in additional-paths
  • This means that core/lib and core are both updated when shared/file.txt is updated as long as the have additional-paths: ["shared"]

@stan-stately stan-stately requested review from a team as code owners May 8, 2025 04:45
Copy link

google-cla bot commented May 8, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label May 8, 2025
@stan-stately
Copy link
Contributor Author

If anyone needs this now you can swap out the release please action with:

      - uses: actions/setup-node@v4
        with:
          node-version: 23
      - id: release-please
        run: |
          npx -y github:stan-stately/release-please#stan/additional-package-paths release-pr \
            --token xxx \
            --repo-url ${{ github.repository }} \
            --config-file release-please-config.json \
            --manifest-file .release-please-manifest.json

@valdmne
Copy link

valdmne commented May 14, 2025

Hi,

I'm actually trying to use your release please action but i'm facing an issue that I don't have on the official release in v4.

My config :

{ "pull-request-title-pattern": "chore${scope}: release${component} ${version}", "separate-pull-requests": true, "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": true, "pull-request-header": "Release changelog", "pull-request-footer": "To be tested on staging before merge", "packages": { "cmd/mygoapp1": { "release-type": "go", "component": "mygoapp1", "package-name": "mygoapp1", "changelog-path": "cmd/mygoapp1/CHANGELOG.md", "tag-prefix": "mygoapp1-v", "additional-paths": [ "internal/mygoapp1", "pkg" ] }, "cmd/mygoapp2": { "release-type": "go", "package-name": "mygoapp2", "component": "mygoapp2", "changelog-path": "cmd/mygoapp2/CHANGELOG.md", "tag-prefix": "mygoapp2-v", "additional-paths": [ "internal/mygoapp2", "pkg" ] }, "web": { "release-type": "node", "package-name": "web", "component": "web", "changelog-path": "web/CHANGELOG.md", "tag-prefix": "web-v" } } }

The PR is created correctly, the files and commits from the other folders are detected correctly, but when I merge, I still have this error that I don't have with v4:

❯ Found pull request #157: 'chore(main): release mygoapp2 0.1.1' ⚠ There are untagged, merged release PRs outstanding - aborting

But I checked, I don't have any other PR than the one I just merged that is tagged "autorelease: pending".

I checked your code I didn't see anything.

@stan-stately
Copy link
Contributor Author

stan-stately commented May 14, 2025

oh yeah my bad - the action is actually running 2 commands, github-release and release-pr. i hit this myself yesterday. You need two steps:

      - name: Create Releases
        id: github-release
        run: |
          npx -y github:stan-stately/release-please#stan/additional-package-paths github-release \
            --token xxx \
            --repo-url ${{ github.repository }} \
            --config-file release-please-config.json \
            --manifest-file .release-please-manifest.json

      - name: Create Pull Requests
        id: release-pr
        run: |
          npx -y github:stan-stately/release-please#stan/additional-package-paths release-pr \
            --token xxx \
            --repo-url ${{ github.repository }} \
            --config-file release-please-config.json \
            --manifest-file .release-please-manifest.json

@stan-stately
Copy link
Contributor Author

it would be good if the 1st party action supported using a fork but i had a look at it and it would be kinda painful to implement

@stan-stately
Copy link
Contributor Author

if you were using the outputs from action they wont work either now that you are effectively using the CLI

@valdmne
Copy link

valdmne commented May 15, 2025

Okay, great, I understand better! I hope this PR can be integrated quickly, thank you for your work.

@mkrolewicz
Copy link

@chingor13 will this PR be merged any time soon ? It would greatly benefit in my repos

@valdmne
Copy link

valdmne commented Jun 8, 2025

Hi @stan-stately,

Do you know if it's possible to implement the possibility to add files in additional-paths params, and not only folder ?

@stan-stately
Copy link
Contributor Author

@valdmne its possible but it's not 100% clear how to implement. the check is here: https://github.com/googleapis/release-please/pull/2534/files#diff-eb224286fa9cceeaa954fb6f0587f82c0d05a9b238ba7e3c47636a7c34b2cfa9R131:

if (additionalPaths.some(path => file.indexOf(`${path}/`) === 0)) { ... }

it doesn't match filenames because i append the / the end of the additional path before matching it. this is done so additional-paths: ["foo"] matches foo/bar.txt but not football/bar.txt. Probably the cleanest way to do this would be:

if (additionalPaths.some(path => file.indexOf(`${path}/`) === 0 || file === path)) { ... }

i don't want to block this PR on this change because i might not have time to test it and it's not 100% obvious that this is the right choice. it would be better to do this in a follow up.

for now, a possible workaround for you might be to put your file in a dedicated directory. although i understand that might not be possible

@jyoungs
Copy link

jyoungs commented Aug 25, 2025

Related: #2339

@kevinsuedmersen
Copy link

Would really like to see this feature being implemented as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to define multiple paths
7 participants