Update changelog for release

This commit is contained in:
ValarDragon
2021-03-24 09:25:43 -07:00
committed by Pratyush Mishra
parent b8a268d550
commit 2348acf3a1
3 changed files with 74 additions and 23 deletions

View File

@@ -0,0 +1,31 @@
import re
import sys
import fileinput
import os
# Set this to the name of the repo, if you don't want it to be read from the filesystem.
# It assumes the changelog file is in the root of the repo.
repo_name = ""
# This script goes through the provided file, and replaces any " \#<number>",
# with the valid mark down formatted link to it. e.g.
# " [\#number](https://github.com/arkworks-rs/template/pull/<number>)
# Note that if the number is for a an issue, github will auto-redirect you when you click the link.
# It is safe to run the script multiple times in succession.
#
# Example usage $ python3 linkify_changelog.py ../CHANGELOG.md
if len(sys.argv) < 2:
print("Must include path to changelog as the first argument to the script")
print("Example Usage: python3 linkify_changelog.py ../CHANGELOG.md")
exit()
changelog_path = sys.argv[1]
if repo_name == "":
path = os.path.abspath(changelog_path)
components = path.split(os.path.sep)
repo_name = components[-2]
for line in fileinput.input(inplace=True):
line = re.sub(r"\- #([0-9]*)", r"- [\\#\1](https://github.com/arkworks-rs/" + repo_name + r"/pull/\1)", line.rstrip())
# edits the current file
print(line)