Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub action to automatically render skeleton.Rmd when pull requests are made #133

Merged
merged 29 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7491b43
draft github workflow to render visc_empty template skeleton.Rmd
kelliemac Feb 29, 2024
f0004c3
install VISCtemplates instead of using renv
kelliemac Feb 29, 2024
2bfb4cc
add some text to skeleton.Rmd to force github action to run
kelliemac Feb 29, 2024
37c7da2
update workflow to run on workflow dispatch and pull requets
kelliemac Feb 29, 2024
3652c10
add push back to run triggers
kelliemac Feb 29, 2024
b31ee7c
install devtools and dependencies
kelliemac Feb 29, 2024
bfe5229
fix indentatation in yaml
kelliemac Feb 29, 2024
13fb086
simplify devtools installation
kelliemac Feb 29, 2024
766aca3
Update render-visc-empty-skeleton-rmd.yaml
kelliemac Mar 5, 2024
48d3145
Update skeleton.Rmd to trigger gh action
kelliemac Mar 5, 2024
9e5cd18
add missing ' in Rscript -e call
kelliemac Mar 5, 2024
52450c5
Update skeleton.Rmd to not attempt to install VISCfunctions from CRAN
kelliemac Mar 5, 2024
8e7e961
add VISCfunctions installation from GitHub
kelliemac Mar 5, 2024
4116163
add github PAT
kelliemac Mar 5, 2024
0734296
add tinytex installation and additional R packages used in skeleton.Rmd
kelliemac Mar 6, 2024
88cef2a
Update render-visc-empty-skeleton-rmd.yaml
kelliemac Mar 6, 2024
ff1edc3
Re-build visc_empty skeleton Rmd
actions-user Mar 6, 2024
10b1a72
Update render-visc-empty-skeleton-rmd.yaml
kelliemac Mar 6, 2024
e475586
Re-build visc_empty skeleton Rmd
actions-user Mar 6, 2024
d4b70b2
Update render-visc-empty-skeleton-rmd.yaml
kelliemac Mar 6, 2024
0924038
switch from git commit docx/pdf to uploading at gh action artifacts
kelliemac Mar 6, 2024
9e6ab03
Delete skeleton.docx
kelliemac Mar 6, 2024
550c870
Delete skeleton.pdf
kelliemac Mar 6, 2024
e1b6827
Update visc_report skeleton.Rmd to load VISCfunctions with library call
kelliemac Mar 6, 2024
f3da35a
add visc_report skeleton pdf and docx rendering and gh action artifacts
kelliemac Mar 6, 2024
47e9c75
Rename render-visc-empty-skeleton-rmd.yaml to render-skeleton-rmd.yaml
kelliemac Mar 6, 2024
eaf3342
remove gh action run on push to feature dev branch
kelliemac Mar 6, 2024
c1cceaf
Update render-skeleton-rmd.yaml name in file
kelliemac Mar 6, 2024
d6066e8
remove rendering of visc_report skeleton.Rmd due to extra complexities
kelliemac Mar 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/render-skeleton-rmd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Workflow derived from https://rfortherestofus.com/2023/05/github-actions
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
workflow_dispatch:
pull_request:
branches: [ master, main, develop ]

name: render-skeleton-rmd

jobs:
render-skeleton-rmd:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:

- name: Checkout VISCtemplates repo
uses: actions/checkout@v4

- name: Install pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Set up tinytex
uses: r-lib/actions/setup-tinytex@v2

- name: Set up R
uses: r-lib/actions/setup-r@v2

- name: Install R packages from VISCtemplates DESCRIPTION file and any others needed
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
any::remotes
any::devtools
any::conflicted
any::tidyverse

- name: Install VISCfunctions from GitHub
run: |
Rscript -e 'remotes::install_github("FredHutch/VISCfunctions")'

- name: Install VISCtemplates
run: |
Rscript -e 'devtools::install()'

- name: Render visc_empty skeleton.Rmd to all output formats
run: |
Rscript -e 'rmarkdown::render("inst/rmarkdown/templates/visc_empty/skeleton/skeleton.Rmd", output_format="all")'

- name: Upload visc_empty skeleton.docx and skeleton.pdf as GitHub action artifact
uses: actions/upload-artifact@v4
with:
name: visc-empty-skeleton-pdf-and-docx
path: |
inst/rmarkdown/templates/visc_empty/skeleton/skeleton.pdf
inst/rmarkdown/templates/visc_empty/skeleton/skeleton.docx
9 changes: 7 additions & 2 deletions inst/rmarkdown/templates/visc_empty/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Location of input data:

```{r package-loading-and-options, include=FALSE}
library(VISCtemplates)
library(VISCfunctions)

check_pandoc_version()

packages_needed <- c("conflicted", "tidyverse", "knitr", "kableExtra",
"VISCfunctions")
packages_needed <- c("conflicted", "tidyverse", "knitr", "kableExtra")

install_load_cran_packages(packages_needed)

Expand Down Expand Up @@ -89,6 +89,11 @@ pandoc_markup <- set_pandoc_markup(output_type)

# Section Header

Add some text here

## Subsection Header

Add some text here

`r insert_break()`

Expand Down
6 changes: 2 additions & 4 deletions inst/rmarkdown/templates/visc_report/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ Location of input data:

```{r package-loading-and-options, include=FALSE}
library(VISCtemplates)
library(VISCfunctions)

check_pandoc_version()

packages_needed <- c(
"conflicted", "tidyverse", "knitr", "kableExtra", "VISCfunctions"
)

packages_needed <- c("conflicted", "tidyverse", "knitr", "kableExtra")
install_load_cran_packages(packages_needed)

# knitr options
Expand Down
Loading