name: Fetch Parking Data on: schedule: # Run every hour at minute 5 - cron: '5 * * * *' workflow_dispatch: # Allow manual triggers permissions: contents: write jobs: fetch-data: runs-on: ubuntu-latest timeout-minutes: 15 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Use system Python 3.12 run: | ln -sf /root/.local/share/mise/installs/python/3.12/bin/python3.12 /usr/local/bin/python ln -sf /root/.local/share/mise/installs/python/3.12/bin/python3.12 /usr/local/bin/python3 ln -sf /root/.local/share/mise/installs/python/3.12/bin/python3.12 /usr/local/bin/python3.12 - name: Install dependencies run: pip install -r scripts/requirements.txt - name: Restore data cache uses: actions/cache@v4 with: path: data/cache key: parking-cache-${{ github.run_number }} restore-keys: | parking-cache- - name: Fetch parking data run: python scripts/fetch_parking_data.py - name: Commit and push data run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add webapp/public/data/ # Check if there are changes to commit if git diff --staged --quiet; then echo "No changes to commit" exit 0 fi TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M UTC") HOUR=$(date -u +"%H") git commit -m "data: parking snapshot ${TIMESTAMP} (hour ${HOUR})" git push