Make stat table #229
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: Make stat table | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * 1,2,5' | |
jobs: | |
build: | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
# - uses: r-lib/actions/setup-renv@v2 | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/Library/Application\ Support/renv | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: ${{ runner.os }}-renv- | |
- name: Activate Renv | |
run: | | |
install.packages("renv") | |
renv::activate() | |
shell: Rscript {0} | |
# - uses: r-lib/actions/setup-renv@v2 | |
- name: Install packages | |
run: | | |
install.packages(c("tidyverse", "glue", "ggimage", "DBI", "RSQLite", "gsisdecoder", "remotes", "nflfastR", "htmltools")) | |
shell: Rscript {0} | |
# - name: Install dependencies | |
# uses: r-lib/actions/setup-r-dependencies@v2 | |
# with: | |
# extra-packages: ggplot | |
- name: Run script | |
run: Rscript tables/tableworkflow.R | |
- name: Clean up table for embedding | |
run: | | |
grep -v '<style>body{background-color:white;}</style>' tables/latest.html > tables/latest2.html | |
grep -v DOCTYPE tables/latest2.html > tables/latest3.html | |
rm tables/latest.html tables/latest2.html | |
mv tables/latest3.html tables/latest.html | |
- name: Commit results | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add tables/latest.html tables/latestbars.png | |
git commit -m 'Update latest table' || echo "No changes to commit" | |
git push origin master || echo "No changes to commit" |