Update Data #167
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@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run update-city-detail | |
run: npm run update-city-detail | |
- name: Run update-map-data | |
run: npm run update-map-data | |
- 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@v3 | |
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" |