Switch all postings to JSON for consistency and betterness
Even though everything *except* status worked just fine the 'wrong' way!
This commit is contained in:
parent
32583205b6
commit
1df3f14ecd
1 changed files with 4 additions and 4 deletions
|
@ -49,7 +49,7 @@ def move_issue(source_owner, source_repo, issue_number, destination_owner, desti
|
||||||
create_issue_url = API_CREATE_ISSUE.format(instance=FORGEJO_INSTANCE, owner=destination_owner, repo=destination_repo)
|
create_issue_url = API_CREATE_ISSUE.format(instance=FORGEJO_INSTANCE, owner=destination_owner, repo=destination_repo)
|
||||||
# print(create_issue_url)
|
# print(create_issue_url)
|
||||||
headers = {"Authorization": f"token {FORGEJO_API_TOKEN}"}
|
headers = {"Authorization": f"token {FORGEJO_API_TOKEN}"}
|
||||||
created_response = requests.post(create_issue_url, headers=headers, data=json_response)
|
created_response = requests.post(create_issue_url, headers=headers, json=json_response)
|
||||||
|
|
||||||
json_response = created_response.json()
|
json_response = created_response.json()
|
||||||
message = json_response.pop('message', False)
|
message = json_response.pop('message', False)
|
||||||
|
@ -72,7 +72,7 @@ def move_issue(source_owner, source_repo, issue_number, destination_owner, desti
|
||||||
json_comments = comments.json()
|
json_comments = comments.json()
|
||||||
|
|
||||||
for comment in json_comments:
|
for comment in json_comments:
|
||||||
new_comment = requests.post(create_comment_url, headers=headers, data=comment)
|
new_comment = requests.post(create_comment_url, headers=headers, json=comment)
|
||||||
json_new_comment = new_comment.json()
|
json_new_comment = new_comment.json()
|
||||||
message = json_new_comment.pop('message', False)
|
message = json_new_comment.pop('message', False)
|
||||||
if message:
|
if message:
|
||||||
|
@ -85,10 +85,10 @@ def move_issue(source_owner, source_repo, issue_number, destination_owner, desti
|
||||||
moved_from_message = {
|
moved_from_message = {
|
||||||
'body': f"*Issue moved here from:* {old_issue_url}"
|
'body': f"*Issue moved here from:* {old_issue_url}"
|
||||||
}
|
}
|
||||||
new_comment = requests.post(create_comment_url, headers=headers, data=moved_from_message)
|
new_comment = requests.post(create_comment_url, headers=headers, json=moved_from_message)
|
||||||
|
|
||||||
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, json=moved_to_message)
|
||||||
|
|
||||||
# And finally, close the old issue.
|
# And finally, close the old issue.
|
||||||
# If we are confident the API is remaining stabel we can just use the same path
|
# If we are confident the API is remaining stabel we can just use the same path
|
||||||
|
|
Loading…
Reference in a new issue