Skip to content

Commit

Permalink
feat: add workflow to rebuild README.Rmd automatically
Browse files Browse the repository at this point in the history
- when CI rebuilds README.Rmd it should also use the badge of the git-branch so the codecov gets an update
  • Loading branch information
ilyaZar committed Aug 9, 2023
1 parent b462d88 commit 51113f0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/render-rmarkdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help

# Controls when the action will run: for now dev and master
on:
push:
branches: [master, dev]

name: render-rmarkdown

jobs:
render-rmarkdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
# Checks-out golem repo so the job can access it
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-renv@v2

# install CRAN packages used inside README.Rmd
- name: install required packages
run: Rscript -e 'install.packages(c("rmarkdown", "covr"))'
# Render READEME.md using rmarkdown
- name: render README
run: Rscript -e 'rmarkdown::render("README.Rmd", output_format = "md_document")'
- name: Render Rmarkdown files and Commit Results
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add README.md
git commit -m "Re-build README.md" || echo "No changes to commit"
git push origin || echo "No changes to commit"

0 comments on commit 51113f0

Please sign in to comment.