lib/jira_sync/plugin.rb in danger-jira_sync-0.0.5 vs lib/jira_sync/plugin.rb in danger-jira_sync-0.0.6

- old
+ new

@@ -136,10 +136,12 @@ end missing_labels end def add_labels_to_issue(labels) - github.api.add_labels_to_an_issue(repo, issue_number, labels) + existing_labels = github.api.labels_for_issue(repo, issue_number).map { |label| label[:name] } + new_labels = labels - existing_labels + github.api.add_labels_to_an_issue(repo, issue_number, new_labels) unless new_labels.empty? rescue Octokit::Error => e warn "#{e.response_status} Error while adding labels [#{labels}] to GitHub issue: #{e.message}" end end end