Skip to content

Bike Tracker

Bike Tracker #868

Workflow file for this run

name: Bike Tracker
on:
schedule:
# Runs every 5 minutes between 8:00 AM and 10:00 AM ET (12:00 PM - 2:00 PM UTC)
- cron: '*/5 13-14 * * *'
jobs:
track_bikes:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip install requests
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Run bike tracking script
run: python get_bikes.py
- name: Commit and push CSV changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add bike_availability.csv
git commit -m "Update bike availability data" || echo "No changes to commit"
git push origin HEAD:main # Ensure correct branch for push