Support for comments.

master
Dan 5 years ago
parent fdd1e0a94a
commit 5a03acf33c

@ -9,7 +9,6 @@ HEADERS = {
'Content-Type': 'application/json',
}
# TODO: Append comments!
def main(input_path, hostname, project_path, username, password):
issues = json.load(open(input_path))['issues']
type_to_label_id = {}
@ -58,8 +57,23 @@ def main(input_path, hostname, project_path, username, password):
headers=HEADERS,
data=json.dumps({'labels': [label_id]}),
)
return # TODO: remove me
# Add comments for the issue.
for entry in issue['history']:
if not entry['comment']:
continue
requests.post(
issue_url + '/comments',
auth=(username, password),
headers=HEADERS,
data=json.dumps({
'body': entry['comment'] + '\n\n---\nComment on {created_at} by {author}.'.format(
created_at=entry['created_at'],
author=entry['user'][1]
),
}),
)
if __name__ == '__main__':

Loading…
Cancel
Save