Update parcel data and networks #320
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 parcel data and networks | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 1 * * 1-5' # Mon-Fri, 1AM UTC / 7PM CST | |
env: | |
GEOCODIO_API_KEY: ${{ secrets.GEOCODIO_API_KEY_SECRET }} | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
GITHUB_PAT: ${{ secrets.PAT }} | |
jobs: | |
update-networks: | |
runs-on: ubuntu-latest | |
# it should take <10 minutes, but reinstalling the cache can take longer | |
timeout-minutes: 60 | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: Install packages | |
uses: r-lib/actions/setup-r-dependencies@v2 # automatically sets up cache | |
with: | |
packages: | | |
any::tidyverse | |
any::igraph | |
any::tidygraph | |
any::ggraph | |
any::stringi | |
any::tidygeocoder | |
any::svglite | |
any::here | |
any::rlist | |
any::jsonlite | |
any::httr | |
any::lubridate | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: fetch MPROP | |
run: Rscript -e 'source("processing-scripts/fetch-mprop.R")' | |
- name: standardize MPROP addresses | |
run: Rscript -e 'source("processing-scripts/mprop-standardize-addresses.R")' | |
- name: repair MPROP names | |
run: Rscript -e 'source("processing-scripts/mprop-repair-owner-names.R")' | |
- name: subset WDFI | |
run: Rscript -e 'source("processing-scripts/subset-wdfi-in-mprop.R")' | |
- name: standardize WDFI address | |
run: Rscript -e 'source("processing-scripts/wdfi-standardize-addresses.R")' | |
- name: igraph owner networks | |
run: Rscript -e 'source("processing-scripts/identify-owner-networks.R")' | |
- name: update new graph SVGs | |
run: Rscript -e 'source("processing-scripts/update-network-graph-svgs.R")' | |
- name: update overall summary stats | |
run: Rscript -e 'source("processing-scripts/update-overall-summary-stats.R")' | |
- uses: actions/setup-node@v4 | |
- name: Optimize SVGs | |
run: | | |
npm install -g svgo | |
git diff --diff-filter=d -z --name-only ./images/networks-svg | xargs -0 -n 1 svgo --config svgo.config.js | |
- name: Commit results | |
# Commit all changed files back to the repository | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Data updates | |
- name: push networked mprop | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-directory: 'data/final-output' | |
destination-github-username: 'jdjohn215' | |
destination-repository-name: 'mkepropertynetworks-summary' | |
target-directory: "data" | |
user-email: jdjohn215@gmail.com | |
target-branch: main | |