Add code for closing old issue that *should* work, but doesn't

see https://codeberg.org/forgejo/forgejo/issues/1280#issuecomment-1262414
This commit is contained in:
benjamin melançon 2023-10-04 18:26:43 -04:00
parent 564fb23055
commit e82c747636

View file

@ -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`