Skip to content

Commit 997f4a0

Browse files
ysh329junrushao
authored andcommitted
[Misc][Release] Extend PR tags and Format PR hyper-links in release report (apache#15298)
1 parent 06659e0 commit 997f4a0

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

tests/scripts/release/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ Once done, you can download the csv file assuming with name `out_pr_gathered_cor
3030

3131
```bash
3232
# example: use a csv of tags-corrected PRs to create a markdown file
33-
# If you want to export monthly report on forum, you need append arg
34-
# `--is-pr-with-link true`.
35-
python make_notes.py --notes-csv out_pr_gathered_corrected.csv > out.md
33+
34+
# Export monthly report on forum:
35+
python make_notes.py --notes out_pr_gathered_corrected.csv --is-pr-with-link true > monthly_report.md
36+
37+
# Export release report on Github:
38+
python make_notes.py --notes out_pr_gathered_corrected.csv --is-pr-with-link true > release_report.md
39+
40+
# If release report exported but forget set `--is-pr-with-link true`,
41+
# you can append arg `--convert-with-link true`.
42+
python3 make_notes.py --notes ./release_report.md --convert-with-link true
3643
```
3744

3845
You can also create a list of RFCs

tests/scripts/release/make_notes.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from pathlib import Path
2222
import csv
2323
import sys
24+
import re
2425
from collections import defaultdict
2526

2627
REPO_ROOT = Path(__file__).resolve().parent.parent.parent.parent
@@ -36,10 +37,12 @@
3637
"tensorrt": "cuda & cutlass & tensorrt",
3738
"ethosn": "Ethosn",
3839
"hexagon": "Hexagon",
39-
"metal": "metal",
40+
"metal": "Metal",
41+
"vulkan": "Vulkan",
4042
"cmsis-nn": "CMSIS-NN",
4143
"clml": "OpenCL & CLML",
4244
"opencl": "OpenCL & CLML",
45+
"openclml": "OpenCL & CLML",
4346
"adreno": "Adreno",
4447
"acl": "ArmComputeLibrary",
4548
"rocm": "ROCm",
@@ -86,6 +89,8 @@
8689
"bug": "BugFix",
8790
"hotfix": "BugFix",
8891
"relay": "Relay",
92+
"qnn": "Relay",
93+
"quantization": "Relay",
8994
"tvmscript": "TVMScript",
9095
"tvmscripts": "TVMScript",
9196
"tvmc": "TVMC",
@@ -156,16 +161,39 @@ def categorize_csv_file(csv_path: str):
156161
if __name__ == "__main__":
157162
help = "List out commits with attached PRs since a certain commit"
158163
parser = argparse.ArgumentParser(description=help)
159-
parser.add_argument("--notes-csv", required=True, help="csv file of categorized PRs in order")
164+
parser.add_argument(
165+
"--notes", required=True, help="csv or markdown file of categorized PRs in order"
166+
)
160167
parser.add_argument(
161168
"--is-pr-with-link",
162169
required=False,
163170
help="exported pr number with hyper-link for forum format",
164171
)
172+
parser.add_argument(
173+
"--convert-with-link",
174+
required=False,
175+
help="make PR number in markdown file owning hyper-link",
176+
)
165177
args = parser.parse_args()
166178
user = "apache"
167179
repo = "tvm"
168180

181+
if args.convert_with_link:
182+
with open("release_note_0.13.0.md", "r") as f:
183+
lines = f.readlines()
184+
formated = []
185+
for line in lines:
186+
match = re.search(r"#\d+", line)
187+
if match:
188+
pr_num_str = match.group()
189+
pr_num_int = pr_num_str.replace("#", "")
190+
pr_number_str = f"[#{pr_num_int}](https://github.com/apache/tvm/pull/{pr_num_int})"
191+
line = line.replace(pr_num_str, pr_number_str)
192+
formated.append(line)
193+
result = "".join(formated)
194+
print(result)
195+
exit(0)
196+
169197
# 1. Create PR dict from cache file
170198
cache = Path("out.pkl")
171199
if not cache.exists():
@@ -204,7 +232,6 @@ def pr_title(number, heading):
204232
continue
205233
value = dict(value)
206234
output += f"### {key}\n"
207-
208235
misc = []
209236
misc += value.get("n/a", [])
210237
misc += value.get("Misc", [])

0 commit comments

Comments
 (0)