Skip to content

Commit adbd4d3

Browse files
committed
Add support for both query and library change notes
1 parent addef2f commit adbd4d3

File tree

2 files changed

+51
-12
lines changed

2 files changed

+51
-12
lines changed

.vscode/tasks.json

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,32 @@
4040
"problemMatcher": []
4141
},
4242
{
43-
"label": "Create change note",
43+
"label": "Create query change note",
4444
"type": "process",
4545
"command": "python3",
4646
"args": [
4747
"misc/scripts/create-change-note.py",
4848
"${input:language}",
49+
"src",
4950
"${input:name}",
50-
"${input:category}"
51+
"${input:categoryQuery}"
52+
],
53+
"presentation": {
54+
"reveal": "never",
55+
"close": true
56+
},
57+
"problemMatcher": []
58+
},
59+
{
60+
"label": "Create library change note",
61+
"type": "process",
62+
"command": "python3",
63+
"args": [
64+
"misc/scripts/create-change-note.py",
65+
"${input:language}",
66+
"lib",
67+
"${input:name}",
68+
"${input:categoryLibrary}"
5169
],
5270
"presentation": {
5371
"reveal": "never",
@@ -70,25 +88,42 @@
7088
"csharp",
7189
"python",
7290
"ruby",
91+
"rust",
7392
"swift",
7493
]
7594
},
7695
{
7796
"type": "promptString",
7897
"id": "name",
79-
"description": "Name"
98+
"description": "Short name (kebab-case)"
8099
},
81100
{
82101
"type": "pickString",
83-
"id": "category",
84-
"description": "Category",
102+
"id": "categoryQuery",
103+
"description": "Category (query change)",
85104
"options":
86105
[
87-
"minorAnalysis",
106+
"breaking",
107+
"deprecated",
88108
"newQuery",
89-
"fix",
109+
"queryMetadata",
90110
"majorAnalysis",
111+
"minorAnalysis",
112+
"fix",
113+
]
114+
},
115+
{
116+
"type": "pickString",
117+
"id": "categoryLibrary",
118+
"description": "Category (library change)",
119+
"options":
120+
[
91121
"breaking",
122+
"deprecated",
123+
"feature",
124+
"majorAnalysis",
125+
"minorAnalysis",
126+
"fix",
92127
]
93128
}
94129
]

misc/scripts/create-change-note.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# Expects to receive the following arguments:
66
# - What language the change note is for
7+
# - Whether it's a query or library change (the string `src` or `lib`)
78
# - The name of the change note (in kebab-case)
89
# - The category of the change.
910

@@ -17,26 +18,29 @@
1718

1819
# Read the given arguments
1920
language = sys.argv[1]
20-
change_note_name = sys.argv[2]
21-
change_category = sys.argv[3]
21+
subdir = sys.argv[2]
22+
change_note_name = sys.argv[3]
23+
change_category = sys.argv[4]
2224

2325
# Find the root of the repository. The current script should be located in `misc/scripts`.
2426
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
2527

2628
# Go to the repo root
2729
os.chdir(root)
2830

31+
output_dir = f"{language}/ql/{subdir}/change-notes"
32+
2933
# Abort if the output directory doesn't exist
30-
if not os.path.exists(f"{language}/ql/lib/change-notes"):
31-
print(f"Output directory {language}/ql/lib/change-notes does not exist")
34+
if not os.path.exists(output_dir):
35+
print(f"Output directory {output_dir} does not exist")
3236
sys.exit(1)
3337

3438
# Get the current date
3539
import datetime
3640
current_date = datetime.datetime.now().strftime("%Y-%m-%d")
3741

3842
# Create the change note file
39-
change_note_file = f"{language}/ql/lib/change-notes/{current_date}-{change_note_name}.md"
43+
change_note_file = f"{output_dir}/{current_date}-{change_note_name}.md"
4044

4145
change_note = f"""
4246
---

0 commit comments

Comments
 (0)