Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose profile arg from renv::activate() #649

Merged
merged 6 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions setup-renv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ This action installs dependencies for the current R environment based on the ren

Inputs available

- `profile` - default `NULL`. The renv profile that should be activated.
Forwarded to
[`renv::activate()`](https://rstudio.github.io/renv/reference/activate.html). It
must be an R expression. Note that you often need to quote it, see details
below.

Basic:
```yaml
Bisaloo marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-renv@v2
with:
profile: "'shiny'"
```

- `cache-version` - default `1`. If you need to invalidate the existing cache pass any other number and a new cache will be used.

Basic:
Expand All @@ -23,6 +39,16 @@ steps:
cache-version: 2
```

## Quoting R expressions

Several input arguments must be specified as an R expression.
This increases flexibility, but it also causes some inconvenience, since
these expressions often need to be quoted in the YAML file.
A handy tip is is that if your R expression does not contain a single quote,
Bisaloo marked this conversation as resolved.
Show resolved Hide resolved
and you specify it in the YAML in a single line, surrounded by single
quotes (like in the example above for `args`, `error-on` and `check-dir`
right above), that will work.
gaborcsardi marked this conversation as resolved.
Show resolved Hide resolved

# License

The scripts and documentation in this project are released under the [MIT License](LICENSE)
Expand Down
4 changes: 3 additions & 1 deletion setup-renv/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: 'setup-renv'
description: 'Action to setup renv and install R dependencies in the lockfile'
author: 'Jim Hester'
inputs:
profile:
description: 'The renv profile that should be activated. Forwarded to `renv::activate()`. Note that it often needs to be quoted in YAML, see the README for details.'
gaborcsardi marked this conversation as resolved.
Show resolved Hide resolved
cache-version:
description: 'The version of the cache, change this from the default (1) to start over with a fresh cache'
required: true
Expand All @@ -17,7 +19,7 @@ runs:
- name: Install and activate renv
run: |
install.packages("renv")
renv::activate()
renv::activate(profile = ${{ inputs.profile }})
shell: Rscript {0}

- name: Get R and OS version
Expand Down