Render Status #794
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: | |
paths: | |
- '**.Rmd' | |
- '.github/workflows/*' | |
schedule: | |
# daily in the morning (hours in UTC), i.e. 07:00 | |
- cron: '0 7 * * *' | |
repository_dispatch: | |
# for use with peter-evans/repository_dispatch@v1 | |
types: ['status-update'] | |
name: Render Status | |
jobs: | |
render: | |
name: Render Status | |
runs-on: ubuntu-18.04 | |
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 | |
with: | |
r-version: '4.0.3' | |
- uses: r-lib/actions/setup-pandoc@v1 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: Install dependencies | |
run: | | |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") | |
options(repos = c(REPO_NAME = "https://packagemanager.rstudio.com/all/__linux__/bionic/latest")) | |
pak::pkg_install(c("rmarkdown", "gh", "memoise", "purrr", "dplyr", "tidyr", "glue", "readr")) | |
shell: Rscript {0} | |
- name: Render Status Page | |
run: | | |
RMD_PATH=$(ls -r *.Rmd) | |
Rscript -e 'for (file in commandArgs(TRUE)) rmarkdown::render(file)' ${RMD_PATH[*]} | |
- name: Commit results | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git commit --all -m "[status] $(date +'%F %T %Z')" || echo "No changes to commit" | |
git push origin || echo "No changes to commit" |