@@ -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,21 @@ 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 ))
82+
83+ if not api_name :
84+ # Fallback to repo-metadata.json (e.g. for vertexai or Spanner transitional state)
85+ if repo_metadata_path .exists ():
86+ with open (repo_metadata_path , 'r' ) as file :
87+ repo_metadata = json .load (file )
88+ api_name = repo_metadata .get ('api_shortname' )
89+
90+ if api_name :
91+ modules .append (LibraryModule (module_path , api_name ,
92+ version ,
93+ changelog ))
8494 else :
85- # vertexai (handwritten) does not have OwlBot yaml file
86- with open (repo_metadata_path , 'r' ) as file :
87- 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' )
95+ raise Exception (f'Could not determine api-name for { repo_metadata_path } ' )
96+
9697
9798 return modules
9899
@@ -133,7 +134,7 @@ def group_changes_by_api(main_changes: [str]):
133134 elif section == BUG_FIXES_SECTION :
134135 api_to_changelog [api_name ].bug_fixes .append (note )
135136 elif section == DEPENDENCIES_SECTION :
136- api_to_changelog [api_name ].dependencies .append (note )
137+ api_to_changelog [api_name ].dependency_upgrades .append (note )
137138 return api_to_changelog
138139
139140
0 commit comments