Skip to content

Commit 9570693

Browse files
committed
chore(librarian): update configure_state_yaml.py to avoid duplicate entries
1 parent c9e1b8d commit 9570693

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/configure_state_yaml/configure_state_yaml.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ def configure_state_yaml() -> None:
4848
with open(LIBRARIAN_YAML, "r") as state_yaml_file:
4949
state_dict = yaml.safe_load(state_yaml_file)
5050

51+
existing_library_ids = {library["id"] for library in state_dict.get("libraries", [])}
52+
5153
for package_name in packages_to_onboard["packages_to_onboard"]:
54+
# Check for duplication
55+
if package_name in existing_library_ids:
56+
print(f"Skipping package '{package_name}' as it already exists in state.yaml.")
57+
continue
58+
5259
package_path = Path(PACKAGES_DIR / package_name).resolve()
5360
api_paths = []
5461
for individual_metadata_file in package_path.rglob(f"**/{GAPIC_METADATA_JSON}"):

0 commit comments

Comments
 (0)