-
Notifications
You must be signed in to change notification settings - Fork 24
/
update_versions.rb
31 lines (25 loc) · 756 Bytes
/
update_versions.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'open-uri'
require 'rest-client'
require 'json'
require 'pry'
tags_urls = File.read("tags_urls.txt").split.map {|i| i.gsub('"','') }
result = []
tags_urls.each do |tags_url|
tags = JSON.parse(RestClient.get("#{tags_url}?access_token=#{ENV['GITHUB_TOKEN']}"))
if not tags.empty?
#tags.each do |tag|
# version = tag["name"]
# provider = tag["zipball_url"].split("/")[5].match(/terraform-provider-(.*)/)[1]
# puts version.match("[vV](.*)")[1]
#end
version = tags[0]["name"]
provider = tags[0]["zipball_url"].split("/")[5].match(/terraform-provider-(.*)/)[1]
if provider == "azure-classic"
provider = "azure"
end
if provider == "google-beta"
next
end
puts "#{provider}=#{version.match("[vV](.*)")[1]}"
end
end