In [78]:
!git pull
In [79]:
import datetime
from datetime import timedelta
import os
import glob
import re
In [ ]:
In [80]:
today = datetime.date.today()
yesterday = today - timedelta(1)
In [81]:
if yesterday.isoweekday() == 2:
yesterday_str = yesterday.strftime("%Y-%m-%d")
In [82]:
filename = glob.glob("_posts/" + yesterday_str + "*")[0]
In [83]:
with open(filename, "r") as file:
file_text = file.read()
file_text
Out[83]:
In [84]:
file_text = file_text.replace('category: upcoming', 'category: posts')
file_text = file_text.replace('category:upcoming', 'category: posts')
file_text
Out[84]:
In [85]:
with open(filename, "w") as file:
file.write(file_text)
In [86]:
!git commit -a -m "upcoming to posts [automated]"
In [ ]:
# note that you have to have credentials set up to push from a notebook, otherwise you do it manually
!git push
In [ ]: