diff --git a/.scripts/bugreport.py b/.scripts/bugreport.py new file mode 100644 index 00000000..371666a6 --- /dev/null +++ b/.scripts/bugreport.py @@ -0,0 +1,23 @@ +import re + +import click + +search = r'(\s+- \d\.\d\.\d)' +filename = ".github/ISSUE_TEMPLATE/bug_report.yml" + +@click.command() +@click.argument('version') + +def build(version): + with open(filename, "r") as file: + contents = file.read() + old_version = re.search(search, contents)[0] + updated_contents = re.sub(old_version, f'\n - {version}{old_version}', contents) + + with open(filename, "w") as file: + file.write(updated_contents) + file.truncate() + print("Updated version number in bug report template") + +if __name__ == '__main__': + build() \ No newline at end of file diff --git a/.scripts/keywords.py b/.scripts/keywords.py index 7fbacf71..f621de75 100644 --- a/.scripts/keywords.py +++ b/.scripts/keywords.py @@ -67,7 +67,7 @@ def build(files): a_file.write(keyword_2_data) a_file.write(pre_lit_1) a_file.write(literal_1_data) - print("Done") + print("Updated keywords") if __name__ == '__main__': build() \ No newline at end of file diff --git a/.scripts/version.py b/.scripts/version.py index a921e64e..47117c75 100644 --- a/.scripts/version.py +++ b/.scripts/version.py @@ -1,6 +1,8 @@ import re + import click + @click.command() @click.argument('files', type=click.Path("r"), nargs=-1) @click.argument('version') @@ -33,7 +35,7 @@ def build(files, version): with open(file, "w") as a_file: a_file.truncate() a_file.write(data) - print("Done") + print("Updated version in library.properties") if __name__ == '__main__': build() \ No newline at end of file diff --git a/version b/version index ff7bae3b..5bcb9975 100755 --- a/version +++ b/version @@ -64,6 +64,8 @@ if [[ "$part_to_increment" =~ ^[1-3]$ ]]; then python3 .scripts/version.py library.* $incremented_version # Update keywords python3 .scripts/keywords.py src/*.h + # Update Bug Report Template + python3 .scripts/bugreport.py $incremented_version else echo "Invalid part to increment. Please provide a valid part (1, 2, or 3)." exit 1