diff options
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/.github/scripts/extract_from_release_notes.py')
-rw-r--r-- | fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/.github/scripts/extract_from_release_notes.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/.github/scripts/extract_from_release_notes.py b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/.github/scripts/extract_from_release_notes.py new file mode 100644 index 000000000..3802d9211 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/.github/scripts/extract_from_release_notes.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# + +""" +Extract the latest release notes content from RELEASE_NOTES.md +""" + +import argparse +import os +import sys +import traceback + + +def latest_content(release_notes_path): + """ + can't change the format of the original content + """ + content = "" + start_extract = False + with open(release_notes_path, encoding="utf-8") as f: + for line in f: + if line.startswith("## "): + if start_extract: + break + + start_extract = True + continue + + # hit a separated line + if line.startswith("---"): + break + + content += line + + content += os.linesep + return content + + +def main(): + """ + GO!GO!!GO!!! + """ + parser = argparse.ArgumentParser(description="run the sample and examine outputs") + parser.add_argument("release_notes_path", type=str) + args = parser.parse_args() + + ret = 1 + try: + print(latest_content(args.release_notes_path)) + ret = 0 + except AssertionError: + traceback.print_exc() + return ret + + +if __name__ == "__main__": + sys.exit(main()) |