Skip to content

Commit f7d8878

Browse files
authored
chore(generator): Fix api listing so it recognizes weird versions like content v2.1 (#19954)
1 parent f713d7a commit f7d8878

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.toys/generate-updates.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ def run
7070
def list_apis_versions
7171
return requested.map { |request| request.split(":") } unless all
7272
path = git_cache.find("https://github.com/googleapis/discovery-artifact-manager.git",
73-
path: "discoveries", update: true)
74-
apis_versions = Dir.children(path).map do |name|
75-
match = /^(\w+)\.(\w+)\.json$/.match name
76-
[match[1], match[2]] if match
73+
path: "discoveries/index.json", update: true)
74+
apis_versions = []
75+
JSON.parse(File.read path)["items"].each do |item|
76+
next unless item["preferred"]
77+
apis_versions << [item["name"], item["version"]]
7778
end
78-
apis_versions.compact.shuffle
79+
apis_versions.shuffle
7980
end
8081

8182
def pr_single_gem api, version, index, total

0 commit comments

Comments
 (0)