@@ -142,7 +142,8 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
142
142
# pprint(result.json())
143
143
return result
144
144
145
-
145
+ print "Start"
146
+ print "====="
146
147
# Find all defined projects
147
148
projects = get_projects_from_github (GITHUB_REPO ,GITHUB_TOKEN )
148
149
#pprint(projects)
@@ -160,11 +161,29 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
160
161
#print my_project_id
161
162
162
163
columns = get_columns_from_github (GITHUB_REPO ,GITHUB_TOKEN ,my_project_id )
163
- # pprint(columns)
164
+ pprint (columns )
164
165
# pprint(columns.json())
166
+
167
+ # create temporary index for easy of use
168
+ print "Creating temporary index of existing cards"
169
+ card_index = set ()
165
170
if columns .status_code == 200 :
166
171
for column in columns .json ():
167
- print "Column " + column ["name" ]+ " has id: " + str (column ["id" ])
172
+ print "Index size= " + str (len (card_index ))
173
+ print "Column \" " + column ["name" ]+ "\" has id: " + str (column ["id" ])
174
+ cards = get_project_cards_from_github (GITHUB_REPO ,GITHUB_TOKEN ,column ["id" ])
175
+ print "Just retrieved " + str (len (cards .json ())) + " cards."
176
+ for card in cards .json ():
177
+ #pprint(card)
178
+ # Filter out cards linked to an issue.
179
+ if card .get ("content_url" ) is not None :
180
+ id = card .get ("content_url" ).split ("/" )[- 1 ]
181
+ print "Issue with number " + str (id ) + " already in cards"
182
+ card_index .add (id )
183
+
184
+ pprint (card_index )
185
+ print "Final index size= " + str (len (card_index ))
186
+
168
187
my_column_id = [ column ["id" ] for column in columns .json () if column ["name" ]== destination_column_name ][0 ]
169
188
print "My column id is " + str (my_column_id )
170
189
@@ -186,20 +205,9 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
186
205
187
206
# We now have everything to find out what needs to be done.
188
207
189
- # create temporary index for easy of use
190
- print 80 * "*"
191
- print "Creating temporary index of existing cards"
192
- card_index = set ()
193
- for column in columns .json ():
194
- cards = get_project_cards_from_github (GITHUB_REPO ,GITHUB_TOKEN ,column ["id" ])
195
- for card in cards .json ():
196
- #pprint(card)
197
- if card .get ("content_url" ) is not None :
198
- id = card .get ("content_url" ).split ("/" )[- 1 ]
199
- print "Issue with number " + str (id ) + " already in cards"
200
- card_index .add (id )
201
208
202
- #pprint(card_index)
209
+
210
+ pprint (card_index )
203
211
204
212
print "About to start adding " + str (len (issues .json ())) + " issues to the project."
205
213
print "Adding cards linked to issues"
@@ -227,6 +235,8 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
227
235
228
236
file .close ()
229
237
238
+ else :
239
+ print "ERROR: Getting columns"
230
240
# The end of handling all issue
231
241
232
242
print "Done"
0 commit comments