Auto-update #1095
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: Auto-update | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Install dependencies | |
uses: ./.github/actions/setup-python-poetry | |
with: | |
python-version: "3.12" | |
poetry-version: "1.8.3" | |
poetry-install-args: --without dev | |
- name: Run ETL Process | |
id: etl | |
run: | | |
source .venv/bin/activate | |
python webapp/update/etl.py | |
- name: Check for changes in data/*.csv | |
id: check_changes | |
run: | | |
changes=$(git diff --name-only | grep '^data/.*\.csv$') || true | |
untracked=$(git ls-files --others --exclude-standard | grep '^data/.*\.csv$') || true | |
if [ -n "$changes" ] || [ -n "$untracked" ]; then | |
echo "has_changes=true" >> $GITHUB_ENV | |
else | |
echo "has_changes=false" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: env.has_changes == 'true' | |
run: | | |
git config user.name 'GitHub Actions' | |
git config user.email '[email protected]' | |
echo $(date +%s) > data/metadata | |
git add data | |
git commit -m "chore: update data" | |
git status | |
git push |