Update MDS #32600
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
name: Update MDS | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '15 * * * *' | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install pipenv | |
cd scripts && pipenv install | |
- name: Install transitland-lib | |
run: scripts/install-transitland-lib.sh | |
- name: Fetch latest data | |
run: |- | |
cd scripts && pipenv run python convert-mds-csv-to-dmfr.py > ../feeds/openmobilityfoundation.github.com.dmfr.json | |
- name: Format in the opinionated DMFR format | |
run: | | |
find ./feeds -type f -name "*.dmfr.json" -exec transitland dmfr format --save {} \; | |
- name: Validate feeds | |
run: cd scripts && python validate-feeds.py | |
- name: "If any changes: Create a branch, commit, and PR" | |
run: |- | |
git config user.name "Automated Bot" | |
git config user.email "[email protected]" | |
if ! git_status_output="$(git status --porcelain)"; then | |
error_code="$?" | |
echo "'git status' had an error: $error_code" | |
exit 1 | |
elif [ -z "$git_status_output" ]; then | |
echo "Working directory is clean." | |
else | |
echo "Working directory has UNCOMMITTED CHANGES." | |
BRANCH_NAME=mds-$(date +%F) | |
git checkout -b ${BRANCH_NAME} | |
git add -A | |
git commit -m "Updated MDS feeds from https://github.com/openmobilityfoundation/mobility-data-specification/blob/main/providers.csv at $(date -u)" | |
git push --set-upstream origin ${BRANCH_NAME} | |
gh pr create --title "Automatic update of MDS feeds" --fill-verbose | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |