From ff53b40688c674c30e7f2989eb1a083ef0a23f42 Mon Sep 17 00:00:00 2001 From: Candace Savonen Date: Fri, 25 Feb 2022 10:33:26 -0500 Subject: [PATCH 1/3] Update preview script --- scripts/update-preview.R | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/update-preview.R diff --git a/scripts/update-preview.R b/scripts/update-preview.R new file mode 100644 index 000000000..22e416e3b --- /dev/null +++ b/scripts/update-preview.R @@ -0,0 +1,31 @@ +#!/usr/bin/env Rscript + +# Written by Candace Savonen Sept 2021 + +if (!("optparse" %in% installed.packages())){ + install.packages("optparse") +} + +library(optparse) + +option_list <- list( + optparse::make_option( + c("--repo"), + type = "character", + default = NULL, + help = "GitHub repository name, e.g. jhudsl/OTTR_Template", + ), + optparse::make_option( + c("--git_pat"), + type = "character", + default = NULL, + help = "GitHub personal access token", + ) +) + +# Read the arguments passed +opt_parser <- optparse::OptionParser(option_list = option_list) +opt <- optparse::parse_args(opt_parser) + +repo <- opt$repo +git_pat <- opt$git_pat From c628fab181479bc39462d0e33ff630c43e87d72b Mon Sep 17 00:00:00 2001 From: Candace Savonen Date: Fri, 25 Feb 2022 11:34:04 -0500 Subject: [PATCH 2/3] Specify libs directory --- .github/workflows/pull_request.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c71bdc73e..c86934aa3 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -324,7 +324,9 @@ jobs: # Run bookdown rendering - name: Run bookdown render id: bookdown - run: Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')" + run: | + Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all', + bookdown::gitbook(lib_dir = 'https://raw.githubusercontent.com/jhudsl/OTTR_Template/$branch_name/docs/libs/'))" # Run TOC-less version # Rendered content for Leanpub and Coursera is very similar. From 4d2875a1e44f4f2102c37ec535c38e8cde20b634 Mon Sep 17 00:00:00 2001 From: Candace Savonen Date: Fri, 25 Feb 2022 11:39:17 -0500 Subject: [PATCH 3/3] Specify gitbook --- .github/workflows/pull_request.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c86934aa3..79ac163bb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -325,8 +325,7 @@ jobs: - name: Run bookdown render id: bookdown run: | - Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all', - bookdown::gitbook(lib_dir = 'https://raw.githubusercontent.com/jhudsl/OTTR_Template/$branch_name/docs/libs/'))" + echo bookdown::gitbook(lib_dir = 'https://raw.githubusercontent.com/jhudsl/OTTR_Template/$branch_name/docs/libs/') # Run TOC-less version # Rendered content for Leanpub and Coursera is very similar.