Skip to content

Instantly share code, notes, and snippets.

@benmarwick
Last active November 7, 2022 23:22
Show Gist options
  • Save benmarwick/4e239fcbd05db928e1b988a92fb32285 to your computer and use it in GitHub Desktop.
Save benmarwick/4e239fcbd05db928e1b988a92fb32285 to your computer and use it in GitHub Desktop.
GitHub workflow to render all Rmd files in a GitHub repo, e.g. for testing student assignments
# from https://github.com/cboettig/compendium/blob/master/.github/workflows/main.yml
on: [push]
name: render all R Markdown documents
jobs:
render:
name: render all R Markdown documents
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-tinytex@master
- name: Install known depedencies
run: |
Rscript -e "install.packages(c('bookdown', 'tidyverse', 'rmarkdown', 'knitr', 'devtools', 'here'))"
Rscript -e "devtools::install_github('ThinkR-open/attachment')"
- name: Install unknown depedencies
run: |
Rscript -e "attachment::install_if_missing(attachment::att_from_rmds(path = '.'))"
- name: render all R Markdown documents
run: |
Rscript -e "lapply(list.files(pattern = 'Rmd|rmd', recursive = TRUE), rmarkdown::render)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment