|
|
@ -14,16 +14,14 @@
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
# limitations under the License.
|
|
|
|
# ==============================================================================
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
""" Create release notes with the issues from a milestone.
|
|
|
|
""" Create release notes with the issues from a milestone.
|
|
|
|
python3 release_notes.py -c didi delta v.xxxxx
|
|
|
|
python3 release_notes.py -c didi delta v.xxxxx
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import argparse
|
|
|
|
import urllib.request
|
|
|
|
|
|
|
|
import collections
|
|
|
|
import collections
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import urllib.request
|
|
|
|
|
|
|
|
|
|
|
|
github_url = 'https://api.github.com/repos'
|
|
|
|
github_url = 'https://api.github.com/repos'
|
|
|
|
|
|
|
|
|
|
|
@ -42,50 +40,51 @@ if __name__ == '__main__':
|
|
|
|
metavar='user',
|
|
|
|
metavar='user',
|
|
|
|
type=str,
|
|
|
|
type=str,
|
|
|
|
default='paddlepaddle',
|
|
|
|
default='paddlepaddle',
|
|
|
|
help='github user: paddlepaddle'
|
|
|
|
help='github user: paddlepaddle')
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
'repository',
|
|
|
|
'repository',
|
|
|
|
metavar='repository',
|
|
|
|
metavar='repository',
|
|
|
|
type=str,
|
|
|
|
type=str,
|
|
|
|
default='paddlespeech',
|
|
|
|
default='paddlespeech',
|
|
|
|
help='github repository: paddlespeech'
|
|
|
|
help='github repository: paddlespeech')
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
'milestone',
|
|
|
|
'milestone',
|
|
|
|
metavar='milestone',
|
|
|
|
metavar='milestone',
|
|
|
|
type=str,
|
|
|
|
type=str,
|
|
|
|
help='name of used milestone: v0.3.3'
|
|
|
|
help='name of used milestone: v0.3.3')
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
'-c', '--closed',
|
|
|
|
'-c',
|
|
|
|
|
|
|
|
'--closed',
|
|
|
|
help='Fetch closed milestones/issues',
|
|
|
|
help='Fetch closed milestones/issues',
|
|
|
|
action='store_true'
|
|
|
|
action='store_true')
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.print_help()
|
|
|
|
parser.print_help()
|
|
|
|
args = parser.parse_args()
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
# Fetch milestone infos
|
|
|
|
# Fetch milestone infos
|
|
|
|
url = "%s/%s/%s/milestones" % (
|
|
|
|
url = "%s/%s/%s/milestones" % (github_url, args.user, args.repository)
|
|
|
|
github_url,
|
|
|
|
|
|
|
|
args.user,
|
|
|
|
|
|
|
|
args.repository
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
headers = {
|
|
|
|
headers = {
|
|
|
|
'Origin': 'https://github.com',
|
|
|
|
'Origin':
|
|
|
|
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) '
|
|
|
|
'https://github.com',
|
|
|
|
|
|
|
|
'User-Agent':
|
|
|
|
|
|
|
|
'Mozilla/5.0 (X11; Linux x86_64) '
|
|
|
|
'AppleWebKit/537.11 (KHTML, like Gecko) '
|
|
|
|
'AppleWebKit/537.11 (KHTML, like Gecko) '
|
|
|
|
'Chrome/23.0.1271.64 Safari/537.11',
|
|
|
|
'Chrome/23.0.1271.64 Safari/537.11',
|
|
|
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
|
|
'Accept':
|
|
|
|
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
|
|
|
|
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
|
|
'Accept-Encoding': 'none',
|
|
|
|
'Accept-Charset':
|
|
|
|
'Accept-Language': 'en-US,en;q=0.8',
|
|
|
|
'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
|
|
|
|
'Connection': 'keep-alive'}
|
|
|
|
'Accept-Encoding':
|
|
|
|
|
|
|
|
'none',
|
|
|
|
|
|
|
|
'Accept-Language':
|
|
|
|
|
|
|
|
'en-US,en;q=0.8',
|
|
|
|
|
|
|
|
'Connection':
|
|
|
|
|
|
|
|
'keep-alive'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if args.closed:
|
|
|
|
if args.closed:
|
|
|
|
url += "?state=closed"
|
|
|
|
url += "?state=closed"
|
|
|
@ -107,14 +106,9 @@ if __name__ == '__main__':
|
|
|
|
if not milestone_id:
|
|
|
|
if not milestone_id:
|
|
|
|
parser.error('Cannot find milestone')
|
|
|
|
parser.error('Cannot find milestone')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get milestone related issue info
|
|
|
|
# Get milestone related issue info
|
|
|
|
url = '%s/%s/%s/issues?milestone=%d' % (
|
|
|
|
url = '%s/%s/%s/issues?milestone=%d' % (github_url, args.user,
|
|
|
|
github_url,
|
|
|
|
args.repository, milestone_id)
|
|
|
|
args.user,
|
|
|
|
|
|
|
|
args.repository,
|
|
|
|
|
|
|
|
milestone_id
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if args.closed:
|
|
|
|
if args.closed:
|
|
|
|
url += "&state=closed"
|
|
|
|
url += "&state=closed"
|
|
|
|
|
|
|
|
|
|
|
@ -155,14 +149,9 @@ if __name__ == '__main__':
|
|
|
|
# print('# %s\n%s' % (key, ''.join(value)), file=f)
|
|
|
|
# print('# %s\n%s' % (key, ''.join(value)), file=f)
|
|
|
|
# print('# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' % (' '.join(list(set(thanks_to))))), file=f)
|
|
|
|
# print('# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' % (' '.join(list(set(thanks_to))))), file=f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get milestone related PR info
|
|
|
|
# Get milestone related PR info
|
|
|
|
url = '%s/%s/%s/pulls?milestone=%d' % (
|
|
|
|
url = '%s/%s/%s/pulls?milestone=%d' % (github_url, args.user,
|
|
|
|
github_url,
|
|
|
|
args.repository, milestone_id)
|
|
|
|
args.user,
|
|
|
|
|
|
|
|
args.repository,
|
|
|
|
|
|
|
|
milestone_id
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if args.closed:
|
|
|
|
if args.closed:
|
|
|
|
url += "&state=closed"
|
|
|
|
url += "&state=closed"
|
|
|
|
|
|
|
|
|
|
|
@ -184,12 +173,9 @@ if __name__ == '__main__':
|
|
|
|
labels.append(label['name'])
|
|
|
|
labels.append(label['name'])
|
|
|
|
|
|
|
|
|
|
|
|
thanks_to.append('@%s' % (issue['user']['login']))
|
|
|
|
thanks_to.append('@%s' % (issue['user']['login']))
|
|
|
|
final_data.append(' * **[%s]** - %s #%d by **@%s**\n' % (
|
|
|
|
final_data.append(' * **[%s]** - %s #%d by **@%s**\n' %
|
|
|
|
label['name'],
|
|
|
|
(label['name'], issue['title'], issue['number'],
|
|
|
|
issue['title'],
|
|
|
|
issue['user']['login']))
|
|
|
|
issue['number'],
|
|
|
|
|
|
|
|
issue['user']['login']
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dic = collections.defaultdict(set)
|
|
|
|
dic = collections.defaultdict(set)
|
|
|
|
for l_release in list(set(labels)):
|
|
|
|
for l_release in list(set(labels)):
|
|
|
@ -201,4 +187,7 @@ if __name__ == '__main__':
|
|
|
|
with open(f"release_note_pulls_{args.milestone}.md", 'w') as f:
|
|
|
|
with open(f"release_note_pulls_{args.milestone}.md", 'w') as f:
|
|
|
|
for key, value in dic.items():
|
|
|
|
for key, value in dic.items():
|
|
|
|
print('# %s\n%s' % (key, ''.join(value)), file=f)
|
|
|
|
print('# %s\n%s' % (key, ''.join(value)), file=f)
|
|
|
|
print('# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' % (' '.join(list(set(thanks_to))))), file=f)
|
|
|
|
print(
|
|
|
|
|
|
|
|
'# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' %
|
|
|
|
|
|
|
|
(' '.join(list(set(thanks_to))))),
|
|
|
|
|
|
|
|
file=f)
|
|
|
|