Skip to content

Madison weather update #1

Madison weather update

Madison weather update #1

on:
schedule:
- cron: "0 18 * * *"
workflow_dispatch:
name: Madison weather update
jobs:
render:
name: Update graphs
runs-on: ubuntu-latest
timeout-minutes: 5
env:
RENV_PATHS_ROOT: ~/.local/share/renv
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
# don't reinstall R
install-r: false
# use RStudio's CRAN mirror with precompiled binaries
use-public-rspm: true
- name: Cache packages
uses: actions/cache@v4
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Restore packages
shell: Rscript {0}
run: |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
renv::restore()
- name: Retrieve data
uses: nick-fields/retry@v3
with:
timeout_seconds: 60
max_attempts: 3
command: Rscript -e 'source("R/Retrieve_GHCN_USW00014837.R")'
continue_on_error: true
- name: Commit data
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update data
- name: Build temperature graph
run: Rscript -e 'source("R/BuildDailyHigh.R")'
- name: Build precipitation graph
run: Rscript -e 'source("R/BuildCumulativePrecipitation.R")'
- name: Commit graphs
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update graphs