File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 2222 python cron/update_questions.py
2323 - uses : stefanzweifel/git-auto-commit-action@v4
2424 with :
25- commit_message : update questions ( cron job)
25+ commit_message : Update questions via run- cron GitHub Action
Original file line number Diff line number Diff line change 1+ import os
2+ import json
13import requests
24from datetime import datetime
3- import json
45
56query = '''query questionData($titleSlug: String!) {
67 question(titleSlug: $titleSlug) {
910}
1011'''
1112
12- questions_file = ".. /src/data/questions.json"
13+ questions_file = os . getcwd () + " /src/data/questions.json"
1314
14- print ("Reading questions file" )
15+ print ("=== Reading questions file === " )
1516
1617try :
1718 with open (questions_file , "r" ) as file :
2021 print (e )
2122 exit ()
2223
23- print ("Updating question metadata" )
24+ print ("=== Updating question metadata ===" )
25+
26+ startTime = datetime .now ()
2427
2528for question in questions ["data" ]:
2629 variables = {"titleSlug" : question ["url" ]}
3639 print (f'{ question ["name" ]} : { our_difficulty } -> { leetcode_difficulty } ' )
3740 question ["difficulty" ] = leetcode_difficulty
3841
39- print ("Finished checking all questions" )
42+ print ("=== Finished checking all questions === " )
4043
4144try :
4245 with open (questions_file , "w" ) as file :
4649 print (e )
4750 exit ()
4851
49- print ("Wrote questions file" )
52+ print ("=== Wrote questions file ===" )
53+ print (f'=== Script took: { datetime .now () - startTime } seconds ===' )
You can’t perform that action at this time.
0 commit comments