Skip to content

setup-r-dependencies with working-directory fails when renv is present #768

@milanmlft

Description

@milanmlft

Describe the bug
Context: GitHub repo with an R package in a subdirectory with an associated renv environment, example: https://github.com/milanmlft/test-r-lib-actions
When setting working-directory for setup-r-dependencies@v2 to run the GHA workflow in the package subdirectory, I get the error

 Error: 
  ! error in pak subprocess
  Caused by error in `loadNamespace(name)`:
  ! there is no package called ‘pak’

during Dependency resolution.

I think this is happening because pak gets installed before the renv environment in the subdirectory gets activated. Hence pak is not present in the renv library and so is not found.

To Reproduce
Full logs: https://github.com/milanmlft/test-r-lib-actions/actions/runs/6562363561/job/17824139556

Expected behavior
pak should be installed in the renv library of the subdirectory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions