update-csv #264
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: update-csv | |
on: | |
schedule: | |
- cron: 0 21 * * * | |
workflow_dispatch: | |
jobs: | |
update-csv: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' # Use the version of Python that matches your project's requirements | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Update CSV and write to backup file | |
run: | | |
python entrypoint.py | |
- name: Commit and push if there are changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add data/2024.csv | |
git add data/backup/* | |
git pull origin main | |
git commit -m 'Updated data with latest standings' || echo 'No changes to commit' | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |