actions
actions copied to clipboard
`use-public-rspm` not respected w/ renv
Is your feature request related to a problem? Please describe.
When I use setup-renv
, the use-public-rspm
flag on install-r
doesn't seem to apply.
Describe the solution you'd like
I would like the repos in my renv.lock
to use public RSPM if the use-public-rspm
flag is invoked on install-r
.
Alternatively, the ability to manually set a repo on the use-renv
action would be fine.
Describe alternatives you've considered I'm not sure there are any good ones. I could avoid renv.
Or I could switch to public RSPM on my laptop, but that's not great, because then I don't get package binaries for Mac.
Additional context Here's what my workflow looks like:
jobs:
render-book:
name: Render-Book
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: quarto-dev/quarto-actions/install-quarto@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-renv@v2
- run: |
quarto --version
- name: Render Book
run: |
quarto render .
- uses: actions/upload-artifact@v2
with:
name: _site
path: _book/
@akgold, the scenario in which you have a specific repo in the lock file but would like to use a different one for CI is supported in renv via option renv.config.repos.override
or the equivalent environment variable RENV_CONFIG_REPOS_OVERRIDE
(see https://rstudio.github.io/renv/reference/config.html#details)
Given this, the approach
Alternatively, the ability to manually set a repo on the use-renv action would be fine.
should be achievable by setting RENV_CONFIG_REPOS_OVERRIDE
Yep, makes sense. It would be nice ergonomics if that got set automatically based on use-public-rspm
.
How would one set RENV_CONFIG_REPOS_OVERRIDE
in the context of the r-lib/actions/setup-renv@v2
action?
Try https://docs.github.com/en/actions/learn-github-actions/environment-variables
It's like this, for anyone else who was confused:
- name: Set up Renv
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 2
env:
RENV_CONFIG_REPOS_OVERRIDE: "https://packagemanager.rstudio.com/all/latest"
@millerh1, glad to see the approach of using RENV_CONFIG_REPOS_OVERRIDE
is working.
As a further refinement, you can actually leverage the fact that setup-r
defines an RSPM
environment variable with the repos URL. Besides avoiding to write and maintain the URL in the workflow, this has the advantage of relying on the actual OS-specific repository as constructed dynamically by setup-r
, especially relevant for Linux binaries, e.g. https://packagemanager.rstudio.com/all/linux/focal/latest
See e.g. the env. variable in your own workflow: https://github.com/Bishop-Laboratory/RLBase/runs/7061924670?check_suite_focus=true#step:5:9
The following should do the job:
env:
RENV_CONFIG_REPOS_OVERRIDE: ${{ env.RSPM }}
That's a great trick! Thanks for sharing :)
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue