Some of my package functions require a API setting a API key and I'd like to have those functions run on pkgdown, while not publicly exposing the API in my code. How do I enter a Github Secrets to my yaml?
I've not used the secrets in GitHub but I have used the pins package for the API_KEY (to an R Studio Connect server) https://pins.rstudio.com/ I was following what others in my team set up but seemed really secure in that the API key is only located on my computer and not in any script.
For this specific application, I tried to edit the yaml more directly. I figured it out as follows. First, write the variable into the server's .Renviron file with Shell. Then it will be available in any R script of the repo, through Sys.getenv()
In the yaml:
- name: "[Custom block] Add CENSUS API KEY"
run: echo "CENSUS_API_KEY = '${{ secrets.CENSUS_API_KEY }}'" >> .Renviron
where CENSUS_API_KEY is a Github Secrets I added separately.
Then call in the R script, e.g.