Fix syntax #57
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
on: | |
push: | |
branches: main | |
paths: | |
- 'course-materials/**' | |
name: Render course materials | |
jobs: | |
render: | |
name: Render R Markdown files | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 # This is important to set for `git diff-tree` to work below | |
- uses: r-lib/actions/setup-r@v1 | |
- uses: r-lib/actions/setup-pandoc@v1 | |
- name: Install packages | |
run: | | |
#install.packages(c("rmarkdown", "tidyverse", "renv", "remotes")) | |
install.packages(c("rmarkdown", "remotes")) | |
remotes::install_github(c("rundel/checklist", "rstudio-education/dsbox", "hadley/emo", "yihui/xaringan")) | |
shell: Rscript {0} | |
- name: Render R Markdown files | |
run: | | |
changed_files = system("git diff-tree --no-commit-id --name-only -r HEAD", intern = TRUE, wait = TRUE) | |
changed_rmd_files = changed_files[grepl("course-materials/.*\\.[Rr]md", changed_files)] | |
print(changed_rmd_files) # for debugging | |
lapply(changed_rmd_files, checklist::check_rmd_renders, install_missing = TRUE) | |
shell: Rscript {0} | |
- name: Commit results | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add . | |
git commit -m 'Re-render R Markdown files' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" |