diff --git a/.github/workflows/templates.yml b/.github/workflows/templates.yml new file mode 100644 index 00000000..f15cbcd7 --- /dev/null +++ b/.github/workflows/templates.yml @@ -0,0 +1,19 @@ +--- +name: Check Templates + +on: + workflow_dispatch: + pull_request: + branches: + - main + - devel + +jobs: + templates: + name: Check Templates + uses: pharmaverse/admiralci/.github/workflows/check-templates.yml@main + secrets: inherit + with: + r-version: "4.1" + push-templates-data: true + exclude-templates-data: "adrs_basic" diff --git a/inst/templates/ad_adrs.R b/inst/templates/ad_adrs.R index 0a75f46e..dac3af57 100644 --- a/inst/templates/ad_adrs.R +++ b/inst/templates/ad_adrs.R @@ -398,5 +398,10 @@ adrs <- adrs %>% # Save output ---- -dir <- tempdir() # Change to whichever directory you want to save the dataset in -saveRDS(adrs, file = file.path(dir, "adrs.rds"), compress = "bzip2") +dir <- file.path(getwd(), "tmp") +print(dir) +if (!file.exists(dir)) { + # Create the folder + dir.create(dir) +} +save(adrs, file = file.path(dir, "adrs.rda"), compress = "bzip2") diff --git a/inst/templates/ad_adrs_basic.R b/inst/templates/ad_adrs_basic.R index a77cea5d..114fd1a6 100644 --- a/inst/templates/ad_adrs_basic.R +++ b/inst/templates/ad_adrs_basic.R @@ -372,5 +372,10 @@ adrs <- adrs %>% # ---- Save output ---- -dir <- tempdir() # Change to whichever directory you want to save the dataset in -saveRDS(adrs, file = file.path(dir, "adrs.rds"), compress = "bzip2") +dir <- file.path(getwd(), "tmp") +print(dir) +if (!file.exists(dir)) { + # Create the folder + dir.create(dir) +} +save(adrs, file = file.path(dir, "adrs_basic.rda"), compress = "bzip2") diff --git a/inst/templates/ad_adtr.R b/inst/templates/ad_adtr.R index 516f75fe..65093182 100644 --- a/inst/templates/ad_adtr.R +++ b/inst/templates/ad_adtr.R @@ -287,3 +287,13 @@ adtr <- adtr %>% dataset_add = select(adsl, !!!negate_vars(adsl_vars)), by_vars = exprs(STUDYID, USUBJID) ) + +# Save output ---- + +dir <- file.path(getwd(), "tmp") +print(dir) +if (!file.exists(dir)) { + # Create the folder + dir.create(dir) +} +save(adtr, file = file.path(dir, "adtr.rda"), compress = "bzip2") diff --git a/inst/templates/ad_adtte.R b/inst/templates/ad_adtte.R index 80d0b470..2cac3ca2 100644 --- a/inst/templates/ad_adtte.R +++ b/inst/templates/ad_adtte.R @@ -81,5 +81,10 @@ adtte <- adtte %>% # Save output ---- -dir <- tempdir() # Change to whichever directory you want to save the dataset in -saveRDS(adtte, file = file.path(dir, "adtte.rds"), compress = "bzip2") +dir <- file.path(getwd(), "tmp") +print(dir) +if (!file.exists(dir)) { + # Create the folder + dir.create(dir) +} +save(adtte, file = file.path(dir, "adtte.rda"), compress = "bzip2")