mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Add support for both query and library change notes
This commit is contained in:
53
.vscode/tasks.json
vendored
53
.vscode/tasks.json
vendored
@@ -40,14 +40,32 @@
|
|||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Create change note",
|
"label": "Create query change note",
|
||||||
"type": "process",
|
"type": "process",
|
||||||
"command": "python3",
|
"command": "python3",
|
||||||
"args": [
|
"args": [
|
||||||
"misc/scripts/create-change-note.py",
|
"misc/scripts/create-change-note.py",
|
||||||
"${input:language}",
|
"${input:language}",
|
||||||
|
"src",
|
||||||
"${input:name}",
|
"${input:name}",
|
||||||
"${input:category}"
|
"${input:categoryQuery}"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "never",
|
||||||
|
"close": true
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Create library change note",
|
||||||
|
"type": "process",
|
||||||
|
"command": "python3",
|
||||||
|
"args": [
|
||||||
|
"misc/scripts/create-change-note.py",
|
||||||
|
"${input:language}",
|
||||||
|
"lib",
|
||||||
|
"${input:name}",
|
||||||
|
"${input:categoryLibrary}"
|
||||||
],
|
],
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"reveal": "never",
|
"reveal": "never",
|
||||||
@@ -70,25 +88,42 @@
|
|||||||
"csharp",
|
"csharp",
|
||||||
"python",
|
"python",
|
||||||
"ruby",
|
"ruby",
|
||||||
|
"rust",
|
||||||
"swift",
|
"swift",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "promptString",
|
"type": "promptString",
|
||||||
"id": "name",
|
"id": "name",
|
||||||
"description": "Name"
|
"description": "Short name (kebab-case)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "pickString",
|
"type": "pickString",
|
||||||
"id": "category",
|
"id": "categoryQuery",
|
||||||
"description": "Category",
|
"description": "Category (query change)",
|
||||||
"options":
|
"options":
|
||||||
[
|
[
|
||||||
"minorAnalysis",
|
|
||||||
"newQuery",
|
|
||||||
"fix",
|
|
||||||
"majorAnalysis",
|
|
||||||
"breaking",
|
"breaking",
|
||||||
|
"deprecated",
|
||||||
|
"newQuery",
|
||||||
|
"queryMetadata",
|
||||||
|
"majorAnalysis",
|
||||||
|
"minorAnalysis",
|
||||||
|
"fix",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "pickString",
|
||||||
|
"id": "categoryLibrary",
|
||||||
|
"description": "Category (library change)",
|
||||||
|
"options":
|
||||||
|
[
|
||||||
|
"breaking",
|
||||||
|
"deprecated",
|
||||||
|
"feature",
|
||||||
|
"majorAnalysis",
|
||||||
|
"minorAnalysis",
|
||||||
|
"fix",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
# Expects to receive the following arguments:
|
# Expects to receive the following arguments:
|
||||||
# - What language the change note is for
|
# - What language the change note is for
|
||||||
|
# - Whether it's a query or library change (the string `src` or `lib`)
|
||||||
# - The name of the change note (in kebab-case)
|
# - The name of the change note (in kebab-case)
|
||||||
# - The category of the change.
|
# - The category of the change.
|
||||||
|
|
||||||
@@ -17,8 +18,9 @@ import os
|
|||||||
|
|
||||||
# Read the given arguments
|
# Read the given arguments
|
||||||
language = sys.argv[1]
|
language = sys.argv[1]
|
||||||
change_note_name = sys.argv[2]
|
subdir = sys.argv[2]
|
||||||
change_category = sys.argv[3]
|
change_note_name = sys.argv[3]
|
||||||
|
change_category = sys.argv[4]
|
||||||
|
|
||||||
# Find the root of the repository. The current script should be located in `misc/scripts`.
|
# Find the root of the repository. The current script should be located in `misc/scripts`.
|
||||||
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
@@ -26,9 +28,11 @@ root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)
|
|||||||
# Go to the repo root
|
# Go to the repo root
|
||||||
os.chdir(root)
|
os.chdir(root)
|
||||||
|
|
||||||
|
output_dir = f"{language}/ql/{subdir}/change-notes"
|
||||||
|
|
||||||
# Abort if the output directory doesn't exist
|
# Abort if the output directory doesn't exist
|
||||||
if not os.path.exists(f"{language}/ql/lib/change-notes"):
|
if not os.path.exists(output_dir):
|
||||||
print(f"Output directory {language}/ql/lib/change-notes does not exist")
|
print(f"Output directory {output_dir} does not exist")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Get the current date
|
# Get the current date
|
||||||
@@ -36,7 +40,7 @@ import datetime
|
|||||||
current_date = datetime.datetime.now().strftime("%Y-%m-%d")
|
current_date = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||||
|
|
||||||
# Create the change note file
|
# Create the change note file
|
||||||
change_note_file = f"{language}/ql/lib/change-notes/{current_date}-{change_note_name}.md"
|
change_note_file = f"{output_dir}/{current_date}-{change_note_name}.md"
|
||||||
|
|
||||||
change_note = f"""
|
change_note = f"""
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user