From 08e3a4bc23c465e58023de66e44956050279560f Mon Sep 17 00:00:00 2001 From: Lachlan Cannon Date: Tue, 27 Dec 2016 15:25:38 +1100 Subject: [PATCH 1/2] Ensure all labels are loaded. --- gh-issues-import.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gh-issues-import.py b/gh-issues-import.py index ee354e0..aee1cc0 100755 --- a/gh-issues-import.py +++ b/gh-issues-import.py @@ -225,7 +225,15 @@ def get_milestones(which): return send_request(which, "milestones?state=open") def get_labels(which): - return send_request(which, "labels") + page = 1 + labels = [] + while True: + next_labels = send_request(which, "labels?page=%s" % page) + if next_labels: + labels.extend(next_labels) + page += 1 + else: + return labels def get_issue_by_id(which, issue_id): return send_request(which, "issues/%d" % issue_id) @@ -273,7 +281,6 @@ def import_label(source): "name": source['name'], "color": source['color'] } - result_label = send_request('target', "labels", source) print("Successfully created label '%s'" % result_label['name']) return result_label From 4f885346bd583f325ab34bd7c8fa7a2cb3bc6593 Mon Sep 17 00:00:00 2001 From: Lachlan Cannon Date: Tue, 27 Dec 2016 15:27:43 +1100 Subject: [PATCH 2/2] Restore newline. --- gh-issues-import.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gh-issues-import.py b/gh-issues-import.py index aee1cc0..8ee5107 100755 --- a/gh-issues-import.py +++ b/gh-issues-import.py @@ -281,6 +281,7 @@ def import_label(source): "name": source['name'], "color": source['color'] } + result_label = send_request('target', "labels", source) print("Successfully created label '%s'" % result_label['name']) return result_label