@ -31,8 +31,8 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in
* `key` - An explicit key for restoring and saving the cache
* `key` - An explicit key for restoring and saving the cache
* `restore-keys` - An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. Note
* `restore-keys` - An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. Note
`cache-hit` returns false in this case.
`cache-hit` returns false in this case.
* `reeval` - A boolean. Whether to reevaluate the `key` argument in the action's post run script when saving cache. Set to `true` if you would like your cache key set after your job's steps are complete.
* `reeval` - A boolean. Default set to `false`. Whether to reevaluate the `key` argument in the action's post run script when saving cache. Set to `true` if you would like your cache key set after your job's steps are complete.
* `only-restore` - A boolean. Whether to only perform cache restoration and not the save post run script.
* `only-restore` - A boolean. Default set to `false`. Whether to only perform cache restoration and not the save post run script.
For [R Markdown](https://bookdown.org/yihui/rmarkdown-cookbook/cache.html) and [Quarto](https://quarto.org/docs/computations/caching.html#knitr-cache), [knitr](https://yihui.org/knitr/options/#cache) creates a directory of cached code chunk variables & output for chunks where the chunk option `cache=TRUE` is set. The cache directory is typically located in the directory of the input file being rendered. It is named by concating the input `.Rmd` or `.qmd` file name with `_cache` appended.
See the composite action implementation [prncevince/r-actions/setup-knitr-cache](https://github.com/prncevince/r-actions/tree/main/setup-knitr-cache) and corresponding [example](https://github.com/prncevince/r-actions/blob/main/.github/workflows/knitr-cache.yaml) [workflows](https://github.com/prncevince/test-workflow-knitr-cache/blob/main/.github/workflows/knitr-cache.yaml).
Here, we set `reeval` to `true`. This instructs the action to reevalute the cache `key` input variable before saving the cache during the action's post script run when determing if we have met a cache hit. When using knitr caching, we do this because the knitr cache is typically ignored from the Git repo, and invalidation is determined by much more than a diff on the input file. Thus, it makes more sense to evaluate our cache key after knitr code chunk evaluation has completed. For more info on knitr cache invalidation, see [On Cache Invalidation](https://yihui.org/en/2018/06/cache-invalidation/).