I have been trying to use the render-readme.yaml
GitHub Action file from https://github.com/r-lib/actions, suitably modified to suit the setting of rendering a README.md
from README.Rmd
in the root of a Github repo. The workflow I am using is here: https://github.com/gavinsimpson/gratia/blob/master/.github/workflows/render-readme.yaml (and below)
I've tried to reconcile difference between the example from r-lib and the other workflow files they have their, and to install the package(s) needed to render the README.md
. I am having trouble even getting the workflow to show up in the Actions tab for the package repo. An older attempt got it to show up but under a weird name,
Can anyone see what I'm doing wrong or point me to a repo with a working example of using a GH Action workflow to render a README.md
from README.Rmd
?
on:
push:
paths:
- README.Rmd
name: render-readme
jobs:
render-readme:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-pandoc@master
- name: Install rmarkdown
run: Rscript -e 'install.packages("rmarkdown")'
- name: Install required packages
run: Rscript -e 'install.packages("gratia")'
- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")'
- name: Commit results
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit README.md -m 'Re-build README.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"