Update Data #1051
This file contains hidden or 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-directus | |
| run: npm run sync-directus | |
| env: | |
| DIRECTUS_EMAIL: ${{ secrets.DIRECTUS_EMAIL }} | |
| DIRECTUS_PASSWORD: ${{ secrets.DIRECTUS_PASSWORD }} | |
| - name: Gen data set | |
| run: npm run gen-data-set | |
| - 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) ]]; 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" | |
| branch: "automated-data-update" | |
| title: "Update data" | |
| body: | | |
| ⚠️ Check if the PR deletes any places or renames place IDs | |
| (the keys). | |
| When a place is deleted, we also delete its details HTML page, | |
| meaning it will 404. | |
| When a place is renamed, you should update in `data/core.json` | |
| the `encoded` field to use the prior URL value. This allows us | |
| to reuse the prior HTML page. |