update labels on existing issues

in case the issue has been created prior to the label specification
This commit is contained in:
Min RK 2015-09-04 17:32:20 +02:00
parent 0526cdee56
commit 3be0740510

View File

@ -177,6 +177,13 @@ def make_task_issue(github, repo, task, options)
sleep THROTTLE_SECONDS sleep THROTTLE_SECONDS
else else
puts "Found Issue #{repo}##{issue.number}: #{issue.title}" puts "Found Issue #{repo}##{issue.number}: #{issue.title}"
existing_labels = issue.labels.map { |label| label['name']}
missing_labels = options[:labels].reject { |label| existing_labels.include? label }
if not missing_labels.empty?
puts "Updating milestone, labels on #{repo}##{issue.number}"
github.update_issue(repo, issue.number, options)
sleep THROTTLE_SECONDS
end
end end
end end
@ -198,6 +205,13 @@ def make_deliverable_issue(github, repo, deliverable, options)
sleep THROTTLE_SECONDS sleep THROTTLE_SECONDS
else else
puts "Found Issue #{repo}##{issue.number}: #{issue.title}" puts "Found Issue #{repo}##{issue.number}: #{issue.title}"
existing_labels = issue.labels.map { |label| label['name']}
missing_labels = options[:labels].reject { |label| existing_labels.include? label }
if issue.milestone.nil? or not missing_labels.empty?
puts "Updating milestone, labels on #{repo}##{issue.number}"
github.update_issue(repo, issue.number, options)
sleep THROTTLE_SECONDS
end
end end
end end
@ -253,7 +267,7 @@ def populate_workpackage(github, repo, workpackage)
:labels => [ :labels => [
'task', 'task',
workpackage['label'], workpackage['label'],
].join(',') ]
}) })
end end
workpackage['deliverables'].each do |deliverable| workpackage['deliverables'].each do |deliverable|
@ -263,7 +277,7 @@ def populate_workpackage(github, repo, workpackage)
:labels => [ :labels => [
'deliverable', 'deliverable',
workpackage['label'], workpackage['label'],
].join(',') ]
}) })
end end
end end
@ -340,7 +354,7 @@ def load_pdata(proposal_dir)
tasks[name][key] = value tasks[name][key] = value
else else
puts " Ignored: #{args}" # puts " Ignored: #{args}"
end end
end end