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:
parent
564fb23055
commit
e82c747636
1 changed files with 13 additions and 0 deletions
|
@ -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)
|
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)
|
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__":
|
if __name__=="__main__":
|
||||||
# '0' comes in as move_issue.py when this is called as `python move_issue.py`
|
# '0' comes in as move_issue.py when this is called as `python move_issue.py`
|
||||||
|
|
Loading…
Reference in a new issue