Skip to content

.github/workflows/refresh_data.yml #10

.github/workflows/refresh_data.yml

.github/workflows/refresh_data.yml #10

Workflow file for this run

on:
push:
branches: main
schedule:
- cron: '00 03 * * *'
jobs:
import-data:
runs-on: ubuntu-latest
steps:
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Enable P3M
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install dependencies
run: |
Rscript -e 'install.packages(c(
"dplyr",
"googlesheets4",
"janitor",
"purrr",
"readr",
"stats",
"stringr",
"tibble",
"tidyr",
"tidyselect",
"usethis"
))'
- name: Check out repository
uses: actions/checkout@v3
- name: Import data
run: Rscript -e 'source("data-raw/external-data.R")'
- name: Refresh data
run: Rscript -e 'source("data-raw/internal-data.R")'
- name: Commit results
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add 'data-raw/data.csv' 'R/sysdata.rda'
git commit -m 'Data updated' || echo "No changes to commit"
git push origin || echo "No changes to commit"