r-lib/actions

Look for default working directory before using root in `setup-renv`

rjake opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Although I set the default working directory for the workflow, setup-renv defaults to the root directory

Describe the solution you'd like
If no directory is provided to setup-renv step, the action can look at the job and then the workflow defaults before using the root of the repository

defaults:
  run:
    working-directory: # <--- workflow default 'defaults.run.working-directory'

jobs:
  r-stuff:
    defaults:
      run:
        working-directory: # <--- job default 'jobs.<job_id>.defaults.run.working-directory'

Describe alternatives you've considered
Adding the full path again in the step. I know there is a ${{ defaults.run.working-directory }} variable but I don't know how to call it.

Additional context
My code is on an enterprise server so I cannot share the file directly. This is how it is currently structured:

name: write-pins
defaults:
  run:
    working-directory: ./scripts/write-pins  # <---- default set here
        
jobs:  
  write-pins:
    ...
    steps:
      ...
      - uses: r-lib/actions/setup-renv@v2
        with:
          working-directory: ./scripts/write-pins  # <----- path has to start from root 

You need to set working-directory for the setup-renv step, I think.