Correctly handle message when there is *not* a milestone to remove

This commit is contained in:
benjamin melançon 2023-10-04 14:29:19 -04:00
parent 453f7910ae
commit d8cc600aa0

View file

@ -22,9 +22,10 @@ def move_issue(source_owner, source_repo, issue_number, destination_owner, desti
if message:
print(message)
if json_response and 'milestone' in json_response:
print(f"We have removed the milestone {json_response['milestone']['title']} from this issue (milestones are specific to repositories).")
del json_response['milestone']
milestone = json_response.pop('milestone', {})
if milestone:
print(f"We have removed the milestone {milestone['title']} from this issue (milestones are specific to repositories).")
# Note that pop has already thrown out the milestone from json_response
print(f"Creating issue {json_response['title']} now…")