From 9ec60e1c4d48073f90f41f0079396ee3747933d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Wed, 4 Oct 2023 21:14:10 -0400 Subject: [PATCH] Convert assignees listing from dicts to strings --- move_issue.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/move_issue.py b/move_issue.py index 753de31..4b6dd60 100644 --- a/move_issue.py +++ b/move_issue.py @@ -34,6 +34,16 @@ def move_issue(source_owner, source_repo, issue_number, destination_owner, desti 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 + assignees = json_response.pop('assignees', {}) + if assignees: + # 'assignee' is deprecated; remove it. + json_response.pop('assignee', None) + # Forgejo's API *gives* us assignee objects but only *accepts* strings. + # Specifically, we need to replace the dict with its 'login' key. + json_response['assignees'] = [] + for assignee in assignees: + json_response['assignees'].append(assignee['login']) + print(f"Creating issue {json_response['title']} now…") create_issue_url = API_CREATE_ISSUE.format(instance=FORGEJO_INSTANCE, owner=destination_owner, repo=destination_repo)