-
-
Notifications
You must be signed in to change notification settings - Fork 20
43 lines (41 loc) · 1.3 KB
/
database.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}