From 4a8c9b51c54729c11e37e333ab7b90e7e012e7cc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 May 2026 12:58:19 +0000 Subject: [PATCH 1/2] Initial plan From 8f79581297b4f762fc5b58a579f2486b2b2dc6d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 May 2026 13:05:40 +0000 Subject: [PATCH 2/2] Add DESCRIPTION file and update all workflows to use r-lib/actions/setup-r-dependencies Agent-Logs-Url: https://github.com/pharmaverse/blog/sessions/00d31ec3-dfeb-4bff-a5e4-dafb77daff7f Co-authored-by: bms63 <10111024+bms63@users.noreply.github.com> --- .github/workflows/check_post_tags.yml | 10 +++- .github/workflows/link_check.yml | 10 ++-- .github/workflows/pr-preview.yml | 27 ++--------- .github/workflows/publish.yml | 30 ++---------- .github/workflows/spellcheck.yml | 16 +++--- .github/workflows/style_check.yml | 8 +-- DESCRIPTION | 70 +++++++++++++++++++++++++++ R/create_blogpost.R | 4 ++ README.md | 53 +++++--------------- 9 files changed, 121 insertions(+), 107 deletions(-) create mode 100644 DESCRIPTION diff --git a/.github/workflows/check_post_tags.yml b/.github/workflows/check_post_tags.yml index 2a47bde79..9db91a0cd 100644 --- a/.github/workflows/check_post_tags.yml +++ b/.github/workflows/check_post_tags.yml @@ -8,10 +8,16 @@ on: jobs: Check-post-tags: runs-on: ubuntu-latest - container: - image: "rocker/tidyverse:4.2.1" steps: - uses: actions/checkout@v4 + - name: Setup R + uses: r-lib/actions/setup-r@v2 + - name: Install packages + uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: | + any::rmarkdown + any::cli - name: Run check_post_tags run: source("R/check_post_tags.R") shell: Rscript {0} diff --git a/.github/workflows/link_check.yml b/.github/workflows/link_check.yml index bab440ed0..89f8189ff 100644 --- a/.github/workflows/link_check.yml +++ b/.github/workflows/link_check.yml @@ -11,15 +11,13 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up R # Install R from CRAN + - name: Set up R uses: r-lib/actions/setup-r@v2 - with: - r-version: '4.3.3' # You can specify a different R version if needed - name: Install R packages - run: | - Rscript -e 'install.packages("fs")' - shell: bash + uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: any::fs - name: Switch .qmd to .md run: Rscript R/switch.R diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 32107144e..2f1f9f9e3 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -19,37 +19,20 @@ jobs: build-preview: name: Build & Deploy PR Preview runs-on: ubuntu-latest - container: - image: "ghcr.io/pharmaverse/docker_pharmaverse:4.5.1" steps: - name: Check out repository uses: actions/checkout@v4 - - name: Configure Git safe directory - run: git config --global --add safe.directory /__w/blog/blog - - name: Set up Quarto uses: quarto-dev/quarto-actions/setup@v2 with: version: 1.9.12 - - name: Install R Packages - run: | - R -e "install.packages(c( - 'admiral', - 'diffdf', - 'patchwork', - 'here', - 'filters', - 'janitor', - 'link', - 'sessioninfo', - 'renv', - 'riskmetric', - 'sdtm.oak', - 'mirai', - 'dverse', - 'autoslider.core'))" + - name: Setup R + uses: r-lib/actions/setup-r@v2 + + - name: Setup R Dependencies + uses: r-lib/actions/setup-r-dependencies@v2 - name: Install tinytex run: quarto install tool tinytex diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f2e7ab11a..1f252ec7f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,46 +8,26 @@ on: jobs: build-deploy: runs-on: ubuntu-latest - container: - image: "ghcr.io/pharmaverse/docker_pharmaverse:4.5.1" permissions: contents: write steps: - name: Check out repository uses: actions/checkout@v4 - - name: Configure Git safe directory - run: git config --global --add safe.directory /__w/blog/blog - - name: Set up Quarto uses: quarto-dev/quarto-actions/setup@v2 with: version: 1.9.12 - - name: Install R Packages - run: | - R -e "install.packages(c( - 'admiral', - 'diffdf', - 'patchwork', - 'here', - 'filters', - 'janitor', - 'link', - 'sessioninfo', - 'renv', - 'riskmetric', - 'sdtm.oak', - 'mirai', - 'dverse', - 'autoslider.core'))" + - name: Setup R + uses: r-lib/actions/setup-r@v2 + + - name: Setup R Dependencies + uses: r-lib/actions/setup-r-dependencies@v2 - name: Install tinytex run: quarto install tool tinytex - - name: Mark repo directory as safe - run: git config --global --add safe.directory /__w/blog/blog - - name: Publish uses: quarto-dev/quarto-actions/publish@v2 with: diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index b08cc797d..9feb607dd 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -5,18 +5,20 @@ on: jobs: Spelling: runs-on: ubuntu-latest - container: - image: "rocker/tidyverse:4.3.1" steps: - name: Checkout repo uses: actions/checkout@v4 + - name: Setup R + uses: r-lib/actions/setup-r@v2 + - name: Install packages - run: | - if (!require("roxygen2")) install.packages("roxygen2") - if (!require("spelling")) install.packages("spelling") - if (!require("testthat")) install.packages("testthat") - shell: Rscript {0} + uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: | + any::spelling + any::testthat + any::readr - name: Remove links from .qmd files (Bash) run: | diff --git a/.github/workflows/style_check.yml b/.github/workflows/style_check.yml index 80576a871..92612b5d1 100644 --- a/.github/workflows/style_check.yml +++ b/.github/workflows/style_check.yml @@ -5,13 +5,15 @@ on: jobs: Style: runs-on: ubuntu-latest - container: {image: "rocker/tidyverse:4.2.1"} steps: - name: Checkout repo uses: actions/checkout@v4 + - name: Setup R + uses: r-lib/actions/setup-r@v2 - name: Install styler - run: install.packages("styler") - shell: Rscript {0} + uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: any::styler - name: styler version run: packageVersion("styler") shell: Rscript {0} diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 000000000..435d9c7fe --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,70 @@ +Package: pharmaverse.blog +Type: Book +Title: Pharmaverse Blog +Version: 0.1 +Authors@R: + person("pharmaverse", "Blog Team", role = c("aut", "cre")) +Description: This is not a package, but we use this file to declare + the dependencies of the blog site. +URL: https://github.com/pharmaverse/blog +Imports: + admiral, + admiraldev, + admiralmetabolic, + admiralneuro, + admiralonco, + admiralophtha, + admiralpeds, + admiralvaccine, + autoslider.core, + dataviewR, + diffdf, + dplyr, + dverse, + DT, + filters, + forcats, + haven, + here, + janitor, + jsonlite, + knitr, + link, + lubridate, + logrx, + magrittr, + metacore, + metatools, + mirai, + nestcolor, + patchwork, + pharmaverseadam, + pharmaverseraw, + pharmaversesdtm, + reactable, + readr, + readxl, + riskmetric, + rlistings, + rtables, + sdtm.oak, + sessioninfo, + sparkline, + spelling, + stringr, + teal, + teal.data, + teal.modules.clinical, + teal.modules.general, + tern, + tibble, + tidyverse, + xportr, + yaml +Suggests: + rmarkdown, + roxygen2, + styler, + testthat +Encoding: UTF-8 +Language: en-US diff --git a/R/create_blogpost.R b/R/create_blogpost.R index f35452bdb..af820a78e 100644 --- a/R/create_blogpost.R +++ b/R/create_blogpost.R @@ -1,6 +1,10 @@ # You can easily create a new blog post skeleton using the create_post() function. # First, we load the helping function and the allowed post tags: +# If you have not already installed the blog's dependencies, you can do so using pak: +# install.packages("pak") +# pak::pak() # installs all packages listed in the DESCRIPTION file + source("R/help_create_blogpost.R") source("R/allowed_tags.R") diff --git a/README.md b/README.md index d88932b57..a76a5bdb6 100644 --- a/README.md +++ b/README.md @@ -86,49 +86,18 @@ Most importantly: ## Tips and Tricks -* You can use this code snippet to install all packages needed for the blog site or use the docker image cited below. -``` -install.packages( - c( - "jsonlite", - "tidyverse", - "spelling", - "janitor", - "diffdf", - "admiral", - "patchwork", - "here", - "reactable", - "pharmaversesdtm", - "metacore", - "metatools", - "xportr", - "pharmaverseadam", - "link", - "sessioninfo", - "rtables", - "teal", - "riskmetric", - "tidyCDISC", - "mirai", - "dverse", - "DT", - "xportr", - "sdtm.oak", - "teal", - "riskmetric", - "tidyCDISC", - "admiralonco", - "admiralophtha", - "admiralpeds", - "admiralvaccine", - "admiralmetabolic", - "autoslider.core", - "filters" - "logrx" - ) -) +* All packages needed for the blog site are declared in the [`DESCRIPTION`](DESCRIPTION) file at the root of the repository. You can install them all at once using `pak` (recommended for speed, as it uses binary packages and caching): + +```r +# Install pak if you don't have it +install.packages("pak") + +# Install all blog dependencies from the DESCRIPTION file +pak::pak() ``` + +Alternatively, you can use the Docker image described below. + ## How to Use the `blog` Docker Image for Local Development Contributors can benefit from using the [`blog` Docker image](https://github.com/pharmaverse/blog/pkgs/container/blog) when creating their blog posts.