From e82c747636ba2895090a980599b44a27bf4c5739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Wed, 4 Oct 2023 18:26:43 -0400 Subject: [PATCH] Add code for closing old issue that *should* work, but doesn't see https://codeberg.org/forgejo/forgejo/issues/1280#issuecomment-1262414 --- move_issue.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/move_issue.py b/move_issue.py index dc3e01d..753de31 100644 --- a/move_issue.py +++ b/move_issue.py @@ -80,6 +80,19 @@ def move_issue(source_owner, source_repo, issue_number, destination_owner, desti create_old_comment_url = API_CREATE_COMMENT.format(instance=FORGEJO_INSTANCE, owner=source_owner, repo=source_repo, index=issue_number) new_old_comment = requests.post(create_old_comment_url, headers=headers, data=moved_to_message) + # And finally, close the old issue. + # If we are confident the API is remaining stabel we can just use the same path + # with patch, post, and get when the path is the same which is the case here. + # Note though we often change the owner and repo and index when making the URL! + # This runs and the state string is correct and it *should* work but it does not. + # See https://codeberg.org/forgejo/forgejo/issues/1280#issuecomment-1262414 + patch = { + # 'title': "MOVED", + 'state': "closed" + } + patch_issue_url = API_PATCH_ISSUE.format(instance=FORGEJO_INSTANCE, owner=source_owner, repo=source_repo, index=issue_number) + closed_response = requests.patch(patch_issue_url, headers=headers, data=patch) + # print(closed_response.json()) if __name__=="__main__": # '0' comes in as move_issue.py when this is called as `python move_issue.py`