Skip to content

Commit

Permalink
Update update_commit.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunterdii authored Nov 6, 2024
1 parent c5d2933 commit d3bdc9f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/update_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@
response.raise_for_status()
commit_data = response.json()[0] # Get the latest commit

# Fetch the list of changed files in the latest commit
files_url = commit_data["url"] + "/files"
response = requests.get(files_url, headers=headers)
# Extract the commit SHA
commit_sha = commit_data["sha"]

# Fetch the files for the specific commit using its SHA
commit_files_url = f"{GITHUB_API_URL}/repos/{repository}/commits/{commit_sha}"
response = requests.get(commit_files_url, headers=headers)
response.raise_for_status()
files = response.json()
commit_details = response.json()

# Find the solution file from the changed files (based on the folder and expected filename format)
# Check the modified files in the latest commit
solution_filename = None
for file in files:
for file in commit_details["files"]:
# Check if the file is in the "November 2024 GFG SOLUTION" folder and matches the filename pattern
if "November 2024 GFG SOLUTION" in file["filename"]:
solution_filename = file["filename"]
Expand Down

0 comments on commit d3bdc9f

Please sign in to comment.