actions icon indicating copy to clipboard operation
actions copied to clipboard

Support for `renv` profiles in `setup-r` to retrieve R version from `renv.lock` file

Open LDSamson opened this issue 1 year ago • 1 comments

When using renv profiles, it would be great if we can retrieve the R version from one of the profiles' renv.lock files with the setup-r action. Currently I need to hardcode the R version. There is an renv argument in the workflow but it does not take into account renv profiles since it only looks in the package directory for the renv.lock file and not in the renv folder:

https://github.com/r-lib/actions/blob/e8c60692f29164895fbcdbebf2fde501a1f7e07f/setup-r/src/setup-r.ts#L14-L28

An example of the lock files' location when using renv profiles: renv folder, for example like this:

renv
├── activate.R
├── profile
├── profiles
│   ├── full
│   │   ├── renv
│   │   │   ├── settings.json
│   │   │   └── staging
│   │   └── renv.lock
│   └── minimal
│       ├── renv
│       │   ├── settings.json
│       │   └── staging
│       └── renv.lock
└── staging

LDSamson avatar Nov 22 '24 08:11 LDSamson

A PR is welcome for this.

gaborcsardi avatar Nov 22 '24 08:11 gaborcsardi