From 36f06136c96cc7003e14b219e86995789931cbfd Mon Sep 17 00:00:00 2001 From: Het Patel <124852522+Hunterdii@users.noreply.github.com> Date: Wed, 6 Nov 2024 23:09:54 +0530 Subject: [PATCH] Update update_commit.py --- src/update_commit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/update_commit.py b/src/update_commit.py index 46d8ab67..c8cd5c7a 100644 --- a/src/update_commit.py +++ b/src/update_commit.py @@ -19,7 +19,6 @@ month = today.strftime("%b") # Get current month (e.g., Nov) # Generate the filename based on the day of the month (e.g., 06(Nov) Root to leaf paths sum.md) - # The name structure might differ but should follow a predictable pattern today_solution_filename = f"{day_of_month}({month})" # The pattern that matches the filename format. # Make a request to GitHub to list files in the directory @@ -32,6 +31,11 @@ files = response.json() + # Check if files are empty or response is not valid + if isinstance(files, dict) and files.get('message') == 'Not Found': + print(f"Directory not found: {dir_url}") + sys.exit(1) + # Search for the correct file based on the date today_file = None for file in files: