Created
May 29, 2019 13:28
-
-
Save momolog/fa6ed94b77e98e38eea474699a71683a to your computer and use it in GitHub Desktop.
githost export status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
require 'httparty' | |
headers = { | |
'PRIVATE-TOKEN' => ENV['GITHOST_PERSONAL_API_TOKEN'] | |
} | |
(1..121).each do |pid| | |
url = "https://giantmonkey.githost.io/api/v4/projects/#{pid}/export" | |
response = HTTParty.get url, headers: headers | |
if response.success? | |
result = JSON.parse(response.body) | |
p "#{result['id']}: #{result['name']} #{result['export_status']}" | |
# unless ['finished', 'started'].include? result['export_status'] | |
# p "-> triggering export for project #{result['id']} #{result['name']}" | |
# trigger_response = HTTParty.post url, headers: headers | |
# trigger_result = JSON.parse(trigger_response.body) | |
# p trigger_result | |
# end | |
else | |
p "#{pid}: no such project." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment