This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new a4b863a2ff [Misc][Release] Extend PR tags and Format PR hyper-links in 
release report (#15298)
a4b863a2ff is described below

commit a4b863a2fffbac33725f747e57581ce4b5e34f0a
Author: ysh329 <[email protected]>
AuthorDate: Mon Jul 17 09:16:48 2023 +0800

    [Misc][Release] Extend PR tags and Format PR hyper-links in release report 
(#15298)
---
 tests/scripts/release/README.md     | 13 ++++++++++---
 tests/scripts/release/make_notes.py | 33 ++++++++++++++++++++++++++++++---
 2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/tests/scripts/release/README.md b/tests/scripts/release/README.md
index 5d068c65f9..ad823c70b3 100644
--- a/tests/scripts/release/README.md
+++ b/tests/scripts/release/README.md
@@ -30,9 +30,16 @@ Once done, you can download the csv file assuming with name 
`out_pr_gathered_cor
 
 ```bash
 # example: use a csv of tags-corrected PRs to create a markdown file
-# If you want to export monthly report on forum, you need append arg
-# `--is-pr-with-link true`.
-python make_notes.py --notes-csv out_pr_gathered_corrected.csv > out.md
+
+# Export monthly report on forum:
+python make_notes.py --notes out_pr_gathered_corrected.csv --is-pr-with-link 
true > monthly_report.md
+
+# Export release report on Github:
+python make_notes.py --notes out_pr_gathered_corrected.csv --is-pr-with-link 
true > release_report.md
+
+# If release report exported but forget set `--is-pr-with-link true`,
+# you can append arg `--convert-with-link true`.
+python3 make_notes.py --notes ./release_report.md --convert-with-link true
 ```
 
 You can also create a list of RFCs
diff --git a/tests/scripts/release/make_notes.py 
b/tests/scripts/release/make_notes.py
index aa034b1d11..2aa96d6555 100644
--- a/tests/scripts/release/make_notes.py
+++ b/tests/scripts/release/make_notes.py
@@ -21,6 +21,7 @@ import pickle
 from pathlib import Path
 import csv
 import sys
+import re
 from collections import defaultdict
 
 REPO_ROOT = Path(__file__).resolve().parent.parent.parent.parent
@@ -36,10 +37,12 @@ TAG_DICT = {
     "tensorrt": "cuda & cutlass & tensorrt",
     "ethosn": "Ethosn",
     "hexagon": "Hexagon",
-    "metal": "metal",
+    "metal": "Metal",
+    "vulkan": "Vulkan",
     "cmsis-nn": "CMSIS-NN",
     "clml": "OpenCL & CLML",
     "opencl": "OpenCL & CLML",
+    "openclml": "OpenCL & CLML",
     "adreno": "Adreno",
     "acl": "ArmComputeLibrary",
     "rocm": "ROCm",
@@ -86,6 +89,8 @@ TAG_DICT = {
     "bug": "BugFix",
     "hotfix": "BugFix",
     "relay": "Relay",
+    "qnn": "Relay",
+    "quantization": "Relay",
     "tvmscript": "TVMScript",
     "tvmscripts": "TVMScript",
     "tvmc": "TVMC",
@@ -156,16 +161,39 @@ def categorize_csv_file(csv_path: str):
 if __name__ == "__main__":
     help = "List out commits with attached PRs since a certain commit"
     parser = argparse.ArgumentParser(description=help)
-    parser.add_argument("--notes-csv", required=True, help="csv file of 
categorized PRs in order")
+    parser.add_argument(
+        "--notes", required=True, help="csv or markdown file of categorized 
PRs in order"
+    )
     parser.add_argument(
         "--is-pr-with-link",
         required=False,
         help="exported pr number with hyper-link for forum format",
     )
+    parser.add_argument(
+        "--convert-with-link",
+        required=False,
+        help="make PR number in markdown file owning hyper-link",
+    )
     args = parser.parse_args()
     user = "apache"
     repo = "tvm"
 
+    if args.convert_with_link:
+        with open("release_note_0.13.0.md", "r") as f:
+            lines = f.readlines()
+        formated = []
+        for line in lines:
+            match = re.search(r"#\d+", line)
+            if match:
+                pr_num_str = match.group()
+                pr_num_int = pr_num_str.replace("#", "")
+                pr_number_str = 
f"[#{pr_num_int}](https://github.com/apache/tvm/pull/{pr_num_int})"
+                line = line.replace(pr_num_str, pr_number_str)
+            formated.append(line)
+        result = "".join(formated)
+        print(result)
+        exit(0)
+
     # 1. Create PR dict from cache file
     cache = Path("out.pkl")
     if not cache.exists():
@@ -204,7 +232,6 @@ if __name__ == "__main__":
             continue
         value = dict(value)
         output += f"### {key}\n"
-
         misc = []
         misc += value.get("n/a", [])
         misc += value.get("Misc", [])

Reply via email to