From 20e108b588a51abdb4c7ed38a1f74bb76bedd3cc Mon Sep 17 00:00:00 2001 From: Sam Woodman Date: Tue, 5 Sep 2023 16:45:31 -0700 Subject: [PATCH] gh action updates --- .github/workflows/data-to-dwc.yml | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/data-to-dwc.yml b/.github/workflows/data-to-dwc.yml index 90b4ca3..c9282bb 100644 --- a/.github/workflows/data-to-dwc.yml +++ b/.github/workflows/data-to-dwc.yml @@ -10,27 +10,32 @@ jobs: generate-data: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 # Checkout branch into the runner - - uses: r-lib/actions/setup-r@master # Set up R runtime + - uses: actions/checkout@v3 + - uses: r-lib/actions/setup-r@v2 with: - r-version: 'release' - - - name: Setup renv # Set up R env to install packages - run: | - install.packages('remotes') - remotes::install_github("rstudio/renv") - shell: Rscript {0} + r-version: 'renv' + - uses: r-lib/actions/setup-renv@v2 - - uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run + - uses: actions/cache@v3 # Cache packages so won't be compiled everytime job is run with: path: ~/.local/share/renv key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} restore-keys: | ${{ runner.os }}-renv- - - name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc - run: renv::restore() + - name: Cache packages + uses: actions/cache@v3 + with: + path: ~/.local/share/renv + key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} + restore-keys: | + ${{ runner.os }}-renv- + + - name: Restore packages shell: Rscript {0} + run: | + if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") + renv::restore() - name: Generate data # Run the script run: source("R/data_to_dwc.R")