Skip to content

Commit b3f5b5f

Browse files
committed
124: support backup of PR reviews
1 parent a4100fd commit b3f5b5f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

github_backup/github_backup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ def parse_args():
236236
action='store_true',
237237
dest='include_pull_details',
238238
help='include more pull request details in backup [*]')
239+
parser.add_argument('--pull-reviews',
240+
action='store_true',
241+
dest='include_pull_reviews',
242+
help='include pull request reviews in backup. '
243+
'This does not include comments on the reviews, but `--pull-comments` will get those. '
244+
'Use this with `--pull-comments` to capture change suggestions, which appear to be '
245+
'divided between two API endpoints by GitHub.')
239246
parser.add_argument('--labels',
240247
action='store_true',
241248
dest='include_labels',
@@ -883,13 +890,17 @@ def backup_pulls(args, repo_cwd, repository, repos_template):
883890
len(list(pulls.keys()))))
884891
comments_template = _pulls_template + '/{0}/comments'
885892
commits_template = _pulls_template + '/{0}/commits'
893+
reviews_template = _pulls_template + '/{0}/reviews'
886894
for number, pull in list(pulls.items()):
887895
if args.include_pull_comments or args.include_everything:
888896
template = comments_template.format(number)
889897
pulls[number]['comment_data'] = retrieve_data(args, template)
890898
if args.include_pull_commits or args.include_everything:
891899
template = commits_template.format(number)
892900
pulls[number]['commit_data'] = retrieve_data(args, template)
901+
if args.include_pull_reviews or args.include_everything:
902+
template = reviews_template.format(number)
903+
pulls[number]['review_data'] = retrieve_data(args, template)
893904

894905
pull_file = '{0}/{1}.json'.format(pulls_cwd, number)
895906
with codecs.open(pull_file, 'w', encoding='utf-8') as f:

0 commit comments

Comments
 (0)