summaryrefslogtreecommitdiffstats
path: root/.github/workflows/version_check.py
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/version_check.py')
-rw-r--r--.github/workflows/version_check.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/.github/workflows/version_check.py b/.github/workflows/version_check.py
new file mode 100644
index 0000000..c9b3e54
--- /dev/null
+++ b/.github/workflows/version_check.py
@@ -0,0 +1,27 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+
+import datetime
+import pathlib
+import sys
+
+pyproject = (
+ pathlib.Path(__file__).parent.parent.parent
+ / "packages"
+ / "python"
+ / "pyproject.toml"
+)
+
+content = pyproject.read_text(encoding="utf-8")
+
+for line in content.splitlines():
+ if line.startswith("version"):
+ version = line.split("=")[1].strip().strip('"')
+ year, minor, micro = version.split(".")
+ today = datetime.date.today()
+ if int(year) != today.year:
+ print(f"Version {version} year should be {today.year}")
+ sys.exit(1)
+
+print("Version check passed")