Skip to content

add render-module-rmd github action #1

add render-module-rmd github action

add render-module-rmd github action #1

on:
pull_request:
branches:
- main
- master
- development
push:
branches:
- main
- master
- development
paths:
- .github/workflows/render-module-rmd.yaml
- fireSense.Rmd
- fireSense.R
name: Render module Rmd
jobs:
render:
name: Render module Rmd
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: PredictiveEcology/actions/[email protected]
- name: Install other dependencies
run: |
sudo apt-get install -y \
libcurl4-openssl-dev \
libgit2-dev \
libglpk-dev \
libmagick++-dev \
libxml2-dev \
python3-gdal
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Ncpus: 2
- uses: r-lib/actions/setup-pandoc@v2
- uses: PredictiveEcology/actions/[email protected]
with:
GitTag: 'development'
- uses: PredictiveEcology/actions/[email protected]
- uses: PredictiveEcology/actions/[email protected]
- name: Install module package and other dependencies
run: |
pkgs <- SpaDES.core::packages(modules = "[[name]]", paths = "..")[[1]]
Require::Require(pkgs[[1]])
shell: Rscript {0}
- name: Render module Rmd
run: |
rmarkdown::render("fireSense.Rmd", encoding = "UTF-8")
shell: Rscript {0}
- name: Commit results
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
git commit fireSense.html -m 'Re-build fireSense.Rmd' || echo "No changes to commit"
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{github.ref}} || echo "No changes to commit"