Add GitHub action to automatically render skeleton.Rmd when pull requests are made #15
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 ] | |
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 and Commit Results | |
run: | | |
Rscript -e 'rmarkdown::render("inst/rmarkdown/templates/visc_empty/skeleton/skeleton.Rmd", output_format="all")' | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add inst/rmarkdown/templates/visc_empty/skeleton/skeleton.pdf | |
git add inst/rmarkdown/templates/visc_empty/skeleton/skeleton.docx | |
git commit -m 'Re-build visc_empty skeleton Rmd' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" |