Update ZTM data #5539
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
# This is a basic workflow to help you get started with Actions | |
name: Update ZTM data | |
# Controls when the action will run. | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '12 */6 * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
gtfs: | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# https://github.com/actions/checkout | |
- uses: actions/[email protected] | |
with: | |
ref: master | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Update GTFS data | |
run: | | |
cd ./sources/scripts | |
set -x | |
docker build . -t pyrabot | |
# make sure we can write to /tmp/ztm-routes.json from within the container (it's run a user nobody, #65534) | |
sudo chown nobody:nogroup ../ztm-routes.json && ls -lh .. | |
docker run \ | |
--rm \ | |
--volume $(pwd)/../ztm-routes.json:/tmp/ztm-routes.json \ | |
pyrabot python gtfs_ztm.py | |
cd .. && git diff | |
- name: Update JSON file | |
run: | | |
./ztm.py | |
# https://github.com/actions/checkout#push-a-commit-using-the-built-in-token | |
- name: Set up git | |
run: | | |
git config user.name "macbrebot" | |
git config user.email "<[email protected]>" | |
- name: Show a diff | |
run: | | |
git diff | |
git add db/ sources/ | |
- name: Commit if needed | |
continue-on-error: true | |
run: | | |
git commit -m 'ztm: nowe dane' && git push origin master |