Add GitHub action to automatically render skeleton.Rmd when pull requests are made #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 and visc_report versions of skeleton.Rmd to all output formats | |
run: | | |
Rscript -e 'rmarkdown::render("inst/rmarkdown/templates/visc_empty/skeleton/skeleton.Rmd", output_format="all")' | |
Rscript -e 'rmarkdown::render("inst/rmarkdown/templates/visc_report/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 | |
- name: Upload visc_report skeleton.docx and skeleton.pdf as GitHub action artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: visc-report-skeleton-pdf-and-docx | |
path: | | |
inst/rmarkdown/templates/visc_report/skeleton/skeleton.pdf | |
inst/rmarkdown/templates/visc_report/skeleton/skeleton.docx |