Create a bash scipt in .local/bin/ and name it chess.sh
Copy this 👇 to chess.sh
#!/usr/bin/env sh# setting readme_PATH to the path of the cloned reporeadme_PATH=<PATH OF THE CLONED REPO># changing directory to readme_PATHcd $readme_PATH # first, pulling from remote repo to avoid conflict git pull# gives the number of lines of the output of 'git diff origin/main' commandCHANGES_EXIST=$(git diff origin/main | wc -l) # exits the script if there are no changesif [ $CHANGES_EXIST -eq 0 ]; thenexit 0fi# activating the virtual environment. chess/bin/activate# Removing the last 23 lines (the chart)head -n -23 README.md > tmp.txt && mv tmp.txt README.md# Run the python script, and append the output(chart) to README.mdpython3 chess-rating/rating_chart.py >> README.md; # Pushing to github with commit message being date and time of commitgit add .; git commit -q -m "Updated on `date +'%d-%m-%Y %H:%M:%S'`"; git push origin main -q
Run crontab -e in the terminal.
Add this line at the end @weekly /home/<username>/.local/bin/chess >/dev/null 2>&1