diff --git a/move_issue.py b/move_issue.py index 8c585e2..6cc1eb3 100644 --- a/move_issue.py +++ b/move_issue.py @@ -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…")