Update Data #555
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 Data | |
on: | |
schedule: | |
- cron: "0 8 * * *" # Runs every day at 12 midnight PT | |
workflow_dispatch: | |
jobs: | |
update-data: | |
if: github.repository_owner == 'ParkingReformNetwork' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run sync-core-data | |
run: npm run sync-core-data | |
- name: Run sync-extended-data | |
run: npm run sync-extended-data | |
- name: Run sync-lat-lng | |
run: npm run sync-lat-lng | |
- name: Gen CSV | |
run: npm run gen-csv | |
- name: Gen HTML pages | |
run: npm run gen-html | |
- name: Format JSON | |
run: npm run fmt | |
- name: Check for changes | |
id: git_status | |
run: | | |
if [[ -n $(git status --porcelain | grep -v 'scripts/city_detail_last_updated.txt') ]]; then | |
echo "has_changes=true" >> $GITHUB_OUTPUT | |
else | |
echo "has_changes=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Pull Request | |
if: steps.git_status.outputs.has_changes == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.UPDATE_DATA_GITHUB_TOKEN }} | |
commit-message: "Update data" | |
title: "Update data" | |
body: "This PR adds the latest data." | |
branch: "automated-data-update" |