Skip to content

update-computed-numbers #466

update-computed-numbers

update-computed-numbers #466

on:
schedule:
# runs every day at 10:00 AM UTC in jan, feb, aug-dec
- cron: '0 10 * 1,2,9-12 *'
workflow_dispatch:
name: update-computed-numbers
jobs:
update:
name: Update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
- name: Install remotes and nfl4th
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
pak::pak("nflverse/nfl4th", dependencies = TRUE)
shell: Rscript {0}
- name: Install necessary packages
run: |
install.packages(c("callr"), dependencies = TRUE)
shell: Rscript {0}
- name: Run update script
run: Rscript -e 'source("data-raw/_save_computed_numbers.R")'
- name: Commit results
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'writeLines(paste0("export NFL4TH_VERSION=",as.character(packageVersion("nfl4th"))),".ver")'
source .ver
git pull
git add data-raw
git commit -m "Updated on `date` using nfl4th version $NFL4TH_VERSION" || echo "No changes to commit"
git push origin master || echo "No changes to commit"