diff options
author | rebortg <github@ghlr.de> | 2021-02-12 18:27:54 +0100 |
---|---|---|
committer | rebortg <github@ghlr.de> | 2021-02-12 18:27:54 +0100 |
commit | d8b1fa0a094eb0a190c8a61fc3f06d27b0c53f37 (patch) | |
tree | 34b26d21b0df03729956c578af6575ce21335941 /docs | |
parent | 87bb6d5e6e75fe21f1856e436468aeb4ffdd848c (diff) | |
download | vyos-documentation-d8b1fa0a094eb0a190c8a61fc3f06d27b0c53f37.tar.gz vyos-documentation-d8b1fa0a094eb0a190c8a61fc3f06d27b0c53f37.zip |
Releasenotes: add weekly releasenote create script
Diffstat (limited to 'docs')
-rw-r--r-- | docs/_ext/releasenotes.py | 102 | ||||
-rw-r--r-- | docs/changelog/1.3.rst | 3 | ||||
-rw-r--r-- | docs/changelog/index.rst | 1 |
3 files changed, 106 insertions, 0 deletions
diff --git a/docs/_ext/releasenotes.py b/docs/_ext/releasenotes.py new file mode 100644 index 00000000..4bc05e1b --- /dev/null +++ b/docs/_ext/releasenotes.py @@ -0,0 +1,102 @@ +from datetime import datetime +from phabricator import Phabricator +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("-t", "--token", type=str, help="API token", required=True) +parser.add_argument("-b", "--branch", nargs="+", help="List of github branches", required=True) + +args = parser.parse_args() + + +phab = Phabricator(host='https://phabricator.vyos.net/api/', token=args.token) + +''' +# code to find new PHIDs +# show project ids +projects = phab.project.query(limit=200) +for project in projects.response['data']: + print(projects.response['data'][project]['phid'], projects.response['data'][project]['name']) +''' + +projects = { + 'equuleus': { + 'phid': 'PHID-PROJ-zu26ui4vbmvykpjtepij', + 'name': 'VyOS 1.3 Equuleus', + 'filename': 'docs/changelog/1.3.rst', + 'tasks': [], + 'releasenotes': [] + }, + 'current': { + 'phid': 'PHID-PROJ-m4utvy456e2shcprpq3b', + 'name': 'VyOS 1.4 Sagitta', + 'filename': 'docs/changelog/1.4.rst', + 'tasks': [], + 'releasenotes': [] + } +} + +for b in args.branch: + if b not in projects.keys(): + raise Exception('given branch not defined') + +# get project tasks + +for project in projects: + if project not in args.branch: + continue + + _after = None + + # get tasks from API + while True: + #print(f'get {_after}') + _tasks = phab.maniphest.search( + constraints={ + 'projects': [projects[project]['phid']], + #'statuses': ['closed'], + }, + after=_after) + + projects[project]['tasks'].extend(_tasks.response['data']) + _after = _tasks.response['cursor']['after'] + if _after is None: + break + + # prepare tasks for release notes + for task in projects[project]['tasks']: + if task['fields']['status']['value'] in ['resolved']: + #_info = phab.maniphest.info(task_id=task['id']) + #_info = _info.response + releasenote = {} + releasenote['type'] = task['fields']['subtype'] + date = datetime.fromtimestamp(task['fields']['dateClosed']) + releasenote['closedate'] = date.strftime('%Y%m%d') + releasenote['name'] = task['fields']['name'] + releasenote['id'] = task['id'] + #print(f"{project}: {task['fields']['status']} {task['id']}") + projects[project]['releasenotes'].append(releasenote) + + projects[project]['releasenotes'] = sorted( + projects[project]['releasenotes'], key = lambda x: x['closedate'], + reverse=True + ) + + rst_text = "#" * len(projects[project]['name']) + rst_text += f"\n{projects[project]['name']}\n" + rst_text += "#" * len(projects[project]['name']) + rst_text += "\n" + + date = None + for rn in projects[project]['releasenotes']: + if date != rn['closedate']: + rst_text += "\n\n" + rst_text += f"{rn['closedate']}\n" + underline = '=' * len(rn['closedate']) + rst_text += f"{underline}\n\n" + date = rn['closedate'] + rst_text += f"* :vytask:`T{rn['id']}` ({rn['type']}): {rn['name']}\n" + + f = open(projects[project]['filename'], "w") + f.write(rst_text) + f.close() diff --git a/docs/changelog/1.3.rst b/docs/changelog/1.3.rst new file mode 100644 index 00000000..fb55ff5e --- /dev/null +++ b/docs/changelog/1.3.rst @@ -0,0 +1,3 @@ +################# +VyOS 1.3 Equuleus +################# diff --git a/docs/changelog/index.rst b/docs/changelog/index.rst index ae964145..3c44d13d 100644 --- a/docs/changelog/index.rst +++ b/docs/changelog/index.rst @@ -10,6 +10,7 @@ Changelog :maxdepth: 1 :includehidden: + 1.3 1.2.6 1.2.5 1.2.4 |