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

Allow disabling cache in setup-r-dependencies #530

Closed
Bisaloo opened this issue Mar 16, 2022 · 5 comments · Fixed by #539
Closed

Allow disabling cache in setup-r-dependencies #530

Bisaloo opened this issue Mar 16, 2022 · 5 comments · Fixed by #539
Labels
feature a feature request or enhancement

Comments

@Bisaloo
Copy link
Contributor

Bisaloo commented Mar 16, 2022

Is your feature request related to a problem? Please describe.

I'm trying to use act to test workflows locally and avoid spamming commits when I'm developing a complex workflow. Unfortunately, it looks like act doesn't support caching and fails whenever caching is included in a step.

Describe the solution you'd like

I would like to have a way to disable the cache in setup-r-dependencies. Then, it would be possible for act users to do:

- uses: r-lib/actions/setup-r-dependencies@v2
  with:
    cache: ${{ !env.ACT }}

Describe alternatives you've considered

I can't think of any other good alternative. The only option would be to go way to the 'old' way of manually installing dependencies (with remotes) but it means losing all the benefit brought by setup-r-dependencies.

@gaborcsardi
Copy link
Member

Do you want to submit a PR?

@gaborcsardi gaborcsardi added the feature a feature request or enhancement label Mar 16, 2022
@Bisaloo
Copy link
Contributor Author

Bisaloo commented Mar 23, 2022

I'm really confused because I was thinking https://github.com/Bisaloo/actions/commit/f4a22e74b7856a66b20aa93365141a2fbb80810d would be enough but it doesn't look like it's working 🤔

gh::gh("/repos/{owner}/{repo}/actions/cache/usage", owner = "Bisaloo", repo = "testpkg")
#> {
#>   "full_name": "Bisaloo/testpkg",
#>   "active_caches_size_in_bytes": 4860071,
#>   "active_caches_count": 1
#> }

Created on 2022-03-23 by the reprex package (v2.0.1.9000)

https://github.com/Bisaloo/testpkg/blob/main/.github/workflows/R-CMD-check.yaml

@riccardoporreca
Copy link
Contributor

@Bisaloo, I think you need to do use comparison, see e.g.

- if: inputs.run-only != 'true'
name: Setup rchk
run: bash $GITHUB_ACTION_PATH/setup.sh
shell: bash
- if: inputs.setup-only != 'true' && inputs.run-only != 'true'
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: ${{ inputs.cache-version }}
- if: inputs.setup-only != 'true'

Also note you do not need {{ ... }}

@Bisaloo
Copy link
Contributor Author

Bisaloo commented Mar 24, 2022

Ah yes, thanks, that seems to have done the trick! It's quite strange you cannot use boolean values directly

@github-actions
Copy link

github-actions bot commented Nov 5, 2022

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants