-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added render_readme workflow, fixes #29
- Loading branch information
1 parent
ec83b0e
commit d0c9ea3
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
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 |