Skip to content

Commit 5251072

Browse files
author
Jeroen Baten
committed
Still some boogs
1 parent fb7ea7e commit 5251072

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

AddIssuesToProject.py

+26-16
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
142142
# pprint(result.json())
143143
return result
144144

145-
145+
print "Start"
146+
print "====="
146147
# Find all defined projects
147148
projects=get_projects_from_github(GITHUB_REPO,GITHUB_TOKEN)
148149
#pprint(projects)
@@ -160,11 +161,29 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
160161
#print my_project_id
161162

162163
columns=get_columns_from_github(GITHUB_REPO,GITHUB_TOKEN,my_project_id)
163-
# pprint(columns)
164+
pprint(columns)
164165
# pprint(columns.json())
166+
167+
# create temporary index for easy of use
168+
print "Creating temporary index of existing cards"
169+
card_index=set()
165170
if columns.status_code==200:
166171
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+
168187
my_column_id=[ column["id"] for column in columns.json() if column["name"]==destination_column_name ][0]
169188
print "My column id is " + str(my_column_id)
170189

@@ -186,20 +205,9 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
186205

187206
# We now have everything to find out what needs to be done.
188207

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)
201208

202-
#pprint(card_index)
209+
210+
pprint(card_index)
203211

204212
print "About to start adding " + str(len(issues.json())) + " issues to the project."
205213
print "Adding cards linked to issues"
@@ -227,6 +235,8 @@ def create_project_card(repo,token,my_column_id,my_issue_id):
227235

228236
file.close()
229237

238+
else:
239+
print "ERROR: Getting columns"
230240
# The end of handling all issue
231241

232242
print "Done"

0 commit comments

Comments
 (0)