feat(render-readme): render nunjucks templates #2
Workflow file for this run
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: | ||
workflow_call: | ||
inputs: | ||
run: | ||
type: boolean | ||
default: true | ||
branch_name: | ||
type: string | ||
required: true | ||
jobs: | ||
render: | ||
if: ${{ inputs.run }} | ||
name: 📖 README | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
- name: Setup Pandoc | ||
uses: r-lib/actions/setup-pandoc@v2 | ||
- name: Install rmarkdown | ||
run: Rscript -e 'install.packages("rmarkdown")' | ||
- name: Setup Node.Js | ||
uses: actions/setup-node@v3 | ||
- name: Install nunjucks | ||
run: npm install nunjucks | ||
- name: Resolve nunjucks templates | ||
run: echo "require('nunjucks'); var res = nunjucks.render("README.Rmd", {repo: '${{ github.event.repository.name }}'}); console.log(res)" | node | ||
- name: Render README | ||
run: Rscript -e 'rmarkdown::render("README.Rmd")' | ||
- name: Commit and push changes | ||
run: | | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
git switch ${{ inputs.branch_name }} | ||
git commit README.md -m 'docs(README): Re-build README.Rmd' || echo "No changes to commit" | ||
git push |