@@ -39,27 +39,31 @@ def get_changes(path):
3939 '#### Known issues :warning:\n ' + issues + '\n \n ' + \
4040 '#### Other changes\n ' + other
4141
42- # auto_bugfixes = get_changes('libnavui-androidauto/changelog/unreleased/bugfixes/')
43- # auto_features = get_changes('libnavui-androidauto/changelog/unreleased/features/')
44- #
45- # auto_changelog = '#### Features\n' + auto_features + '\n\n' + \
46- # '#### Bug fixes and improvements\n' + auto_bugfixes
47- #
48- # print(auto_changelog)
42+ auto_bugfixes = get_changes ('libnavui-androidauto/changelog/unreleased/bugfixes/' )
43+ auto_features = get_changes ('libnavui-androidauto/changelog/unreleased/features/' )
44+
45+ auto_changelog = '# Android Auto Changelog\n ' + \
46+ '#### Features\n ' + auto_features + '\n \n ' + \
47+ '#### Bug fixes and improvements\n ' + auto_bugfixes
4948
5049pr_comments_url = 'https://api.github.com/repos/mapbox/mapbox-navigation-android/issues/' + pr_number + '/comments'
5150headers = {"Authorization" : "Bearer " + token }
5251comments = requests .get (pr_comments_url , headers = headers ).json ()
5352
54- comment_with_changelog_id = None
55- for comment in comments :
56- if comment ['body' ].startswith ('# Changelog' ):
57- comment_with_changelog_id = comment ['id' ]
5853
59- if comment_with_changelog_id :
60- comments_url = 'https://api.github.com/repos/mapbox/mapbox-navigation-android/issues/comments/'
61- comment_url = comments_url + str (comment_with_changelog_id )
62- requests .patch (comment_url , json = {'body' : changelog }, headers = headers )
63- else :
64- requests .post (pr_comments_url , json = {'body' : changelog }, headers = headers )
54+ def update_comment (title , content ):
55+ comment_with_changelog_id = None
56+ for comment in comments :
57+ if comment ['body' ].startswith (title ):
58+ comment_with_changelog_id = comment ['id' ]
59+
60+ if comment_with_changelog_id :
61+ comments_url = 'https://api.github.com/repos/mapbox/mapbox-navigation-android/issues/comments/'
62+ comment_url = comments_url + str (comment_with_changelog_id )
63+ requests .patch (comment_url , json = {'body' : content }, headers = headers )
64+ else :
65+ requests .post (pr_comments_url , json = {'body' : content }, headers = headers )
66+
6567
68+ update_comment ('# Changelog' , changelog )
69+ update_comment ('# Android Auto Changelog' , auto_changelog )
0 commit comments