.github/workflows/dashboard.yml #921
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
# completed could be success or failure | |
# Additional job checks determine the behavior, see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow | |
on: | |
workflow_run: | |
workflows: [score] | |
types: | |
- completed | |
workflow_dispatch: | |
name: render-rmarkdown | |
jobs: | |
render-rmarkdown: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
container: rocker/geospatial | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# - uses: r-lib/actions/setup-renv@v1 | |
- name: Install | |
run: | | |
Rscript -e "install.packages('remotes')" | |
Rscript -e "install.packages('DT')" | |
Rscript -e "install.packages('reticulate')" | |
Rscript -e "remotes::install_deps()" | |
- name: Render | |
shell: Rscript {0} | |
run: |- | |
rmarkdown::render("html/home.Rmd", envir = globalenv()) | |
rmarkdown::render("html/fishing.Rmd", envir = globalenv()) | |
rmarkdown::render("html/climate.Rmd", envir = globalenv()) | |
rmarkdown::render("html/epidemic.Rmd", envir = globalenv()) | |
rmarkdown::render("html/conservation.Rmd", envir = globalenv()) | |
rmarkdown::render("html/wildfire.Rmd", envir = globalenv()) | |
rmarkdown::render("html/errors.Rmd", envir = globalenv()) | |
- name: Commit results | |
run: | | |
git config --global --add safe.directory $GITHUB_WORKSPACE | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add html/*.html | |
git commit -m 'Re-build Rmarkdown files' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" |