From e441001e13ad23e2b39b2d23b6301bdb13258d10 Mon Sep 17 00:00:00 2001 From: "mr. M" Date: Wed, 1 Jan 2025 17:31:48 +0100 Subject: [PATCH] feat: enhance twilight-to-stable script to accept workflow ID and add date --- scripts/twilight-to-stable.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/twilight-to-stable.py b/scripts/twilight-to-stable.py index 0da657a..5a25349 100644 --- a/scripts/twilight-to-stable.py +++ b/scripts/twilight-to-stable.py @@ -1,16 +1,26 @@ import json +import sys +import datetime TWILIGHT_RELEASE_NOTES = "./src/release-notes/twilight.json" STABLE_RELEASE_NOTES = "./src/release-notes/stable.json" def main(): + if len(sys.argv) != 2: + print("Usage: python scripts/twilight-to-stable.py ") + sys.exit(1) + + workflow_id = int(sys.argv[1]) + with open(TWILIGHT_RELEASE_NOTES, "r") as f: twilight = json.load(f) with open(STABLE_RELEASE_NOTES, "r") as f: stable = json.load(f) + twilight["workflowId"] = workflow_id + twilight["date"] = datetime.datetime.now().strftime("%d/%m/%Y") stable.append(twilight) with open(STABLE_RELEASE_NOTES, "w") as f: @@ -20,3 +30,6 @@ def main(): json.dump({}, f, indent=2) print("Twilight release notes merged into stable release notes.") + +if __name__ == "__main__": + main() \ No newline at end of file