Skip to content

Commit

Permalink
added render_readme workflow, fixes #29
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlambert committed Sep 28, 2022
1 parent ec83b0e commit d0c9ea3
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/render_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Name of the workflow
name: render-readme

# Controls when the action will run. Triggers include:
#
# - button trigger from github action page
# - on changes to readme.Rmd

on:
workflow_dispath:
push:
branches:
- 'main'
paths:
- 'README.Rmd'

# A workflow is made up of one or more jobs that can run sequentially or in parallel
# Important: ubuntu-latest is not set up properly for R, so use macOS
jobs:
render-readme:
runs-on: macos-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
persist-credentials: false # to avoid reusing these credentials when pushing

- name: Setup R
- uses: r-lib/actions/setup-r@v2

- name: Setup pandoc
- uses: r-lib/actions/setup-pandoc@v2

- name: Install dependencies
run: |
Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNNINGS = "true")
options(install.packages.check.source = "no")
pkgs <- c("rmarkdown", "remotes")
install.packages(pkgs, repos = "https://cloud.r-project.org/")
remotes::install_github("epiverse-trace/epiparameter")
shell: Rscript {0}


- name: Compile the readme
run: |
rmarkdown::render("readme.Rmd")
shell Rscript {0}

- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git diff-index --quiet HEAD || git commit -m "Automatic readme update"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: {{ secrets.GITHUB_TOKEN }}
branch: 'main'
force: true

0 comments on commit d0c9ea3

Please sign in to comment.