@@ -69,6 +69,7 @@ def detect_modules(root_directory: Path):
6969 tree = ET .parse (module_pom_xml )
7070 root = tree .getroot ()
7171 version = root .find ('mvn:version' , POM_NAMESPACES ).text
72+ api_name = None
7273 if owlbot_yaml_path .exists ():
7374 # If OwlBot configuration file exists (most cases), it's the better
7475 # source to get the OwlBot-generated pull request title prefix than
@@ -78,21 +79,20 @@ def detect_modules(root_directory: Path):
7879 match = re .search (r'api-name: (.+)' , owlbot_yaml_content )
7980 if match :
8081 api_name = match .group (1 )
81- modules .append (LibraryModule (module_path , api_name ,
82- version ,
83- changelog ))
84- else :
85- # vertexai (handwritten) does not have OwlBot yaml file
82+
83+ if not api_name :
84+ # Fallback to repo-metadata.json (e.g. for vertexai or Spanner transitional state)
8685 with open (repo_metadata_path , 'r' ) as file :
8786 repo_metadata = json .load (file )
88- api_name = repo_metadata ['api_shortname' ]
89- if api_name :
90- modules .append (LibraryModule (repo_metadata_path .parent , api_name ,
91- version ,
92- changelog ))
93- else :
94- raise Exception (f'repo_metadata_path { repo_metadata_path } does'
95- f' not have api_shortname field' )
87+ api_name = repo_metadata .get ('api_shortname' )
88+
89+ if api_name :
90+ modules .append (LibraryModule (module_path , api_name ,
91+ version ,
92+ changelog ))
93+ else :
94+ raise Exception (f'Could not determine api-name for { repo_metadata_path } ' )
95+
9696
9797 return modules
9898
@@ -133,7 +133,7 @@ def group_changes_by_api(main_changes: [str]):
133133 elif section == BUG_FIXES_SECTION :
134134 api_to_changelog [api_name ].bug_fixes .append (note )
135135 elif section == DEPENDENCIES_SECTION :
136- api_to_changelog [api_name ].dependencies .append (note )
136+ api_to_changelog [api_name ].dependency_upgrades .append (note )
137137 return api_to_changelog
138138
139139
0 commit comments