Generate and Publish CSV #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate CSV | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
publish_csv: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Required to update | |
run: | | |
start_date="2023-12-28" | |
current_date=$(date -u +"%Y-%m-%d") | |
diff_days=$(( ( $(date -u -d "$current_date" +%s) - $(date -u -d "$start_date" +%s) ) / 86400 )) | |
if (( diff_days % 28 == 0 )); then | |
echo "A multiple of 28 days has elapsed since the start date." | |
python vrps.py | |
else | |
echo "A multiple of 28 days has not yet elapsed since the start date." | |
fi | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit" | |
else | |
git commit -m "Update CSV" | |
git push | |
fi |