Support for comments.
This commit is contained in:
parent
fdd1e0a94a
commit
5a03acf33c
|
@ -9,7 +9,6 @@ HEADERS = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: Append comments!
|
|
||||||
def main(input_path, hostname, project_path, username, password):
|
def main(input_path, hostname, project_path, username, password):
|
||||||
issues = json.load(open(input_path))['issues']
|
issues = json.load(open(input_path))['issues']
|
||||||
type_to_label_id = {}
|
type_to_label_id = {}
|
||||||
|
@ -58,8 +57,23 @@ def main(input_path, hostname, project_path, username, password):
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
data=json.dumps({'labels': [label_id]}),
|
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__':
|
if __name__ == '__main__':
|
||||||
|
|
Reference in New Issue