Skip to content

Sync stations

Sync stations #26

Workflow file for this run

name: Sync stations
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * 0'
push:
branches:
- master
paths:
- 'stations/*.json'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Remove stale DB file
run: rm -f stations.db
- name: Get inventory data
run: mysql2sqlite -f stations.db -d ${{ secrets.INVENTORY_DB }} -u ${{ secrets.INVENTORY_USER }} --mysql-password ${{ secrets.INVENTORY_PASSWORD }} -h ${{ secrets.INVENTORY_HOST }}
- name: Get station data
run: python database.py
- name: Commit Files
run: |
git config --local user.email "${{ vars.GIT_EMAIL }}"
git config --local user.name "${{ vars.GIT_USER }}"
git add -A
git diff-index --quiet HEAD || (git commit -a -m "Sync stations" --allow-empty)
- name: Push Changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}