File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 9
9
token = sys .argv [2 ]
10
10
readme_path = sys .argv [3 ]
11
11
12
- headers = {
13
- "Authorization" : f"token { token } "
14
- }
15
-
16
12
# Get the current date
17
13
today = datetime .today ()
18
14
day_of_month = today .strftime ("%d" ) # Get current day of the month (e.g., 06)
19
15
month = today .strftime ("%b" ) # Get current month (e.g., Nov)
20
16
21
17
# Prepare the solution filename for today (e.g., 06(Nov)Root to leaf paths sum.md)
22
- # You can customize this to the exact naming pattern you use
23
18
today_solution_filename = f"{ day_of_month } ({ month } ){ today .strftime ('%A' )} .md"
24
19
20
+ # Prepare the commit URL for today (we don't need to change this as it will be dynamically picked from the latest commit)
21
+ solution_url = f"https://github.com/{ repository } /blob/main/{ month } %202024%20GFG%20SOLUTION/{ today_solution_filename } "
22
+
25
23
# Prepare the badge URL and commit link to update README
26
24
badge_url = "https://img.shields.io/badge/GeeksforGeeks-Solution%20of%20the%20Day-blue"
27
- badge_link = f"[](https://github.com/ { repository } /blob/main/ { month } %202024%20GFG%20SOLUTION/ { day_of_month } ( { month } ) { today . strftime ( '%A' ) } .md)"
25
+ badge_link = f"[]({ solution_url } )" # This makes the badge link to the solution for today
28
26
29
27
# Read the README file and update the sections for commit and badge
30
28
with open (readme_path , "r" ) as readme :
31
29
content = readme .read ()
32
30
33
31
# Update today's solution link (for the commit)
34
- solution_url = f"https://github.com/{ repository } /blob/main/{ month } %202024%20GFG%20SOLUTION/{ day_of_month } ({ month } ){ today .strftime ('%A' )} .md"
35
32
content = re .sub (
36
33
r"(?<=<!--START_SECTION:latest-commit-->).*?(?=<!--END_SECTION:latest-commit-->)" ,
37
34
f"\n { solution_url } \n " ,
You can’t perform that action at this time.
0 commit comments