Skip to content

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

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

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

# 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 ]
push:
branches: [ gh-action-render-skeleton-rmd ]
name: render-visc-empty-skeleton-rmd
jobs:
render-visc-empty-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 Rmarkdown skeleton report
run: |
Rscript -e 'rmarkdown::render("inst/rmarkdown/templates/visc_empty/skeleton/skeleton.Rmd", output_format="all")'
- name: Upload skeleton.pdf as GitHub action artifact
uses: actions/upload-artifact@v4
with:
name: visc-empty-skeleton.pdf
path: inst/rmarkdown/templates/visc_empty/skeleton/skeleton.pdf
- name: Upload skeleton.docx as GitHub action artifact
uses: actions/upload-artifact@v4
with:
name: visc-empty-skeleton.docx
path: inst/rmarkdown/templates/visc_empty/skeleton/skeleton.docx