From b612244003ef9bbf0ca2544da90aef0ca369ee85 Mon Sep 17 00:00:00 2001 From: rudra-iitm Date: Tue, 7 Jan 2025 22:59:38 +0530 Subject: [PATCH] Added precheck for README update markers --- updatesnap/updatesnapyaml.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/updatesnap/updatesnapyaml.py b/updatesnap/updatesnapyaml.py index b9f3c0d..81b3143 100755 --- a/updatesnap/updatesnapyaml.py +++ b/updatesnap/updatesnapyaml.py @@ -87,6 +87,13 @@ def update_readme(self, project_url, parts, readme_path): sys.exit(1) readme_content = readme_data.decode('utf-8') + if ( + "\n" not in readme_content + or "" not in readme_content + ): + print("The required markers are missing in the README file.", file=sys.stderr) + return + parts_contents = "\n".join([ f" - {part['name']} " f"{part['updates'][0]['name'] if part['updates'] else part['version'][0]}" @@ -126,7 +133,8 @@ def parse_args(): parser.add_argument('--yaml-path', action='store', default=None, help='Path to the yaml file') parser.add_argument('--readme-path', action='store', default=None, - help='Path to the README.md file where the parts and their version will be listed.') + help='Path to the README.md file where the parts' + 'and their version will be listed.') parser.add_argument('--verbose', action='store_true', default=False) parser.add_argument('project', default='.', help='The project URI')