-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretry_sync.rb
executable file
·32 lines (27 loc) · 1006 Bytes
/
retry_sync.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
31
32
#!/usr/bin/env ruby
require 'octokit'
@client = Octokit::Client.new
p @client
repos = `ssh [email protected]`.split("\n").collect { |x| x.split.last }
repos.each do |repo|
next unless repo&.include?('/')
component, *_, name = repo.split('/')
gh_repo = "ds9-debian-#{component}/#{name}".freeze
next unless %w(qt plasma kde-extras).include?(component)
begin
status = @client.source_import_progress(gh_repo, accept: 'application/vnd.github.barred-rock-preview')[:status]
if status == 'error'
puts "Retrying #{gh_repo}"
@client.update_source_import(gh_repo, accept: 'application/vnd.github.barred-rock-preview')
end
rescue Octokit::ServiceUnavailable, Octokit::UnprocessableEntity, Octokit::NotFound => e
case e
when Octokit::ServiceUnavailable
retry
when Octokit::UnprocessableEntity
puts "Boo: #{gh_repo}"
when Octokit::NotFound
next
end
end
end