Skip to content

Update to checkout@v3 #56

Update to checkout@v3

Update to checkout@v3 #56

# Modified from
# - https://github.com/r-lib/actions/tree/master/examples#render-rmarkdown
# - https://github.com/gavinsimpson/gratia/blob/master/.github/workflows/readme-renderer.yaml
on:
push:
branches:
- main
- master
name: Render Readme
jobs:
render:
name: Render Readme
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2-branch
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install rmarkdown, remotes, and the local package
run: |
install.packages("remotes")
remotes::install_local(".")
remotes::install_cran("rmarkdown")
remotes::install_cran("devtools")
remotes::install_cran("RCurl")
remotes::install_cran("kableExtra")
remotes::install_cran("desc")
shell: Rscript {0}
- name: Update date field in DESCRIPTION
run: |
pkgdesc <- desc::desc()
if (is.na(pkgdesc$get("Date")) | pkgdesc$get("Date") != Sys.Date()) {
pkgdesc$set("Date", Sys.Date())
pkgdesc$write()
}
shell: Rscript {0}
- name: Render README.md using rmarkdown
run: Rscript -e 'rmarkdown::render("README.Rmd", output_format = "github_document")'
- name: Commit rendered README
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add README.md README.html
git commit -m "Re-build README.md" || echo "No changes to commit"
git push origin master || echo "No changes to commit"
- name: Trigger pkgdown workflow
if: success()
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.REPO_GHA_PAT }}
repository: ${{ github.repository }}
event-type: trigger-pkgdown-workflow
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'