Hello! I have a pretty weird and niche question and I haven't been able to figure things out and would appreciate any insights anyone has to offer here.
I recently figured out how to use GitHub actions in R, and I created a quick-start guide to a database I own using bookdown, and I am looking to have it automatically refresh once a day in order to show a data preview of each table for the current day instead of showing older data in that preview.
I did a lot of playing around with GitHub actions and I was able to pass a secret string that is saved in the repository settings to a .Rmd file and things seemed to work fine, but now that I am doing the same thing to my bookdown project to pass the database login information, it is not able to find the variable that I assign the secret string to:
This is what the .yaml file step looks like:
I removed the db_ip
and db_pswd
secrets to make it easier to read
Any thoughts around why the object db_user
cannot be found when the action runs?
This is what my .yaml file currently looks like:
on:
schedule:
- cron: "40 4 * * *"
name: update-website
jobs:
update-website:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: '3.6'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
CRAN: ${{ matrix.config.cran }}
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@master
- name: Install pandoc and pandoc citeproc
run: |
brew install pandoc
brew install pandoc-citeproc
- name: Install dependencies
run: |
install.packages(c("remotes", "rcmdcheck", 'bookdown','DBI','RMySQL','data.table','knitr','rmarkdown','DT','webshot','PhantomJS'))
shell: Rscript {0}
- name: refresh book
run: Rscript -e 'db_user <- "${{secrets.USER}}"' -e 'db_ip <- "${{secrets.IP}}"' -e 'db_pswd <- "${{secrets.PSWD}}"' -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"