feat(library_generation): generic grouping folder for unversioned libraries staging paths#13341
Conversation
…raries staging paths
There was a problem hiding this comment.
Code Review
This pull request adds support for generating OwlBot configurations for unversioned and proto-only libraries, including corresponding unit tests and golden files. The feedback suggests a more robust extraction of the unversioned directory name from the proto path to handle potential trailing slashes and avoid malformed paths.
| else f"{library_path}/.github/{owlbot_yaml_file}" | ||
| ) | ||
| if not os.path.exists(path_to_owlbot_yaml_file): | ||
| unversioned_dir = remove_version_from(proto_path).split("/")[-1] |
There was a problem hiding this comment.
If proto_path contains a trailing slash (e.g., google/cloud/baremetalsolution/), remove_version_from(proto_path) may also retain it. Splitting by / and taking the last element [-1] would then result in an empty string "", leading to malformed paths in the rendered OwlBot configuration. Stripping trailing slashes or using os.path.basename makes this extraction much more robust.
| unversioned_dir = remove_version_from(proto_path).split("/")[-1] | |
| unversioned_dir = os.path.basename(remove_version_from(proto_path).rstrip("/")) |
Use dynamically resolved grouping folder names (instead of the static 'unversioned' directory placeholder) in OwlBot staging paths for unversioned libraries.