From fea21d919ab1b72497f152cbbc2235e8cca60314 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Tue, 23 Mar 2021 13:59:51 -0500 Subject: [PATCH] Linkify changelog (#46) --- .github/workflows/linkify_changelog.yml | 20 ++++++++++++++++ CHANGELOG.md | 14 +++++------ scripts/linkify_changelog.py | 31 +++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/linkify_changelog.yml create mode 100644 scripts/linkify_changelog.py diff --git a/.github/workflows/linkify_changelog.yml b/.github/workflows/linkify_changelog.yml new file mode 100644 index 0000000..0cbe85f --- /dev/null +++ b/.github/workflows/linkify_changelog.yml @@ -0,0 +1,20 @@ +name: Linkify Changelog + +on: + workflow_dispatch + +jobs: + linkify: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Add links + run: python3 scripts/linkify_changelog.py CHANGELOG.md + - name: Commit + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "Linkify Changelog" + git push \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a1f3dec..19c22ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Requires all crates from `arkworks-rs/algebra` to have version `v0.2.0` or greater. ### Features -- #3 Add constraints for +- [\#3](https://github.com/arkworks-rs/curves/pull/3) Add constraints for `ark-bls12-377`, `ark-ed-on-bls12-377`, `ark-ed-on-bls12-381`, @@ -17,16 +17,16 @@ `ark-mnt6-298`, `ark-mnt4-753`, `ark-mnt6-753`. -- #7 Add benchmarks for Edwards curves. -- #19 Change field constants to be provided as normal strings, instead of in montgomery form. +- [\#7](https://github.com/arkworks-rs/curves/pull/7) Add benchmarks for Edwards curves. +- [\#19](https://github.com/arkworks-rs/curves/pull/19) Change field constants to be provided as normal strings, instead of in montgomery form. ### Improvements -- #42 Remove the dependency of `rand_xorshift`. +- [\#42](https://github.com/arkworks-rs/curves/pull/42) Remove the dependency of `rand_xorshift`. ### Bug fixes -- #28 Fix broken documentation links. -- #38 Compile with `panic='abort'` in release mode, for safety of the library across FFI boundaries. -- #45 Fix `ark-ed-on-mnt4-753`. +- [\#28](https://github.com/arkworks-rs/curves/pull/28) Fix broken documentation links. +- [\#38](https://github.com/arkworks-rs/curves/pull/38) Compile with `panic='abort'` in release mode, for safety of the library across FFI boundaries. +- [\#45](https://github.com/arkworks-rs/curves/pull/45) Fix `ark-ed-on-mnt4-753`. ## v0.1.0 diff --git a/scripts/linkify_changelog.py b/scripts/linkify_changelog.py new file mode 100644 index 0000000..867ae14 --- /dev/null +++ b/scripts/linkify_changelog.py @@ -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 " \#", +# with the valid mark down formatted link to it. e.g. +# " [\#number](https://github.com/arkworks-rs/template/pull/) +# 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) \ No newline at end of file